Unit Test scripts

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@85690 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2012-01-23 23:41:37 +00:00
parent 7ac3ddd7f9
commit 166311bf69
2 changed files with 17 additions and 2 deletions

View File

@ -34,5 +34,7 @@
yui="true" highlight="false"
lowUpperBound="35" highLowerBound="70"/>
<log type="coverage-clover" target="./codeCoverage/codeCoverage.xml"/>
<log type="metrics-xml" target="./metrics/metrics.xml"/>
<log type="test-xml" target="./testResults/logfile.xml" logIncompleteSkipped="false"/>
</logging>
</phpunit>

View File

@ -47,8 +47,21 @@ class testDataFileIterator implements Iterator
private function _parseNextDataset()
{
$dataSet = explode(',',trim(fgets($this->file)));
// Read a line of test data from the file
do {
// Only take lines that contain test data and that aren't commented out
$testDataRow = trim(fgets($this->file));
} while (($testDataRow > '') && ($testDataRow{0} === '#'));
// Discard any comments at the end of the line
list($testData) = explode('//',$testDataRow);
// Split data into an array of individual values and a result
$dataSet = explode(',',$testData);
foreach($dataSet as &$dataValue) {
// discard any white space
$dataValue = trim($dataValue);
// test for the required datatype and convert accordingly
if (!is_numeric($dataValue)) {
if($dataValue == '') {
$dataValue = NULL;
@ -64,7 +77,7 @@ class testDataFileIterator implements Iterator
}
}
} else {
if (is_float($dataValue)) {
if (strpos($dataValue,'.') !== FALSE) {
$dataValue = (float) $dataValue;
} else {
$dataValue = (int) $dataValue;