com phpruntests: Changed to BORK on empty sections: src/rtClassMap.php src/testcase/preconditions/rtHasMandatorySections.php
src/testcase/preconditions/rtHasNoDuplicateSections.php src/testcase/preconditions/rtHasNoEmptySections.php
src/testcase/preconditions/rtIsSectionImplemented.php src/testcase/preconditions/rtIsValidSectionName.php src/testcase/rtPhpTestFile.php
src/testcase/rtTestPreCondition.php src/testgroup/rtPhpTestGroup.php src/testrun

From: Date: Sun, 19 Jul 2009 15:02:26 +0000
Subject: com phpruntests: Changed to BORK on empty sections: src/rtClassMap.php src/testcase/preconditions/rtHasMandatorySections.php
src/testcase/preconditions/rtHasNoDuplicateSections.php src/testcase/preconditions/rtHasNoEmptySections.php
src/testcase/preconditions/rtIsSectionImplemented.php src/testcase/preconditions/rtIsValidSectionName.php src/testcase/rtPhpTestFile.php
src/testcase/rtTestPreCondition.php src/testgroup/rtPhpTestGroup.php src/testrun
Groups: php.qa 
Request: Send a blank email to php-qa+get-66321@lists.php.net to get a copy of this message
Commit: c59da98fbf5d5aff10b18afef1358bc9189032b3 Author: Zoe Slattery <zoe@php.net> Sun, 19 Jul 2009 15:02:26 +0000 Parents: 6386a2b0d28f1db68eaca12234fc0799aeb2fc31 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=c59da98fbf5d5aff10b18afef1358bc9189032b3 Log: Changed to BORK on empty sections Changed paths: M src/rtClassMap.php M src/testcase/preconditions/rtHasMandatorySections.php M src/testcase/preconditions/rtHasNoDuplicateSections.php A src/testcase/preconditions/rtHasNoEmptySections.php M src/testcase/preconditions/rtIsSectionImplemented.php M src/testcase/preconditions/rtIsValidSectionName.php M src/testcase/rtPhpTestFile.php M src/testcase/rtTestPreCondition.php M src/testgroup/rtPhpTestGroup.php M src/testrun/rtPhpTestRun.php A src/texts/emptySection.txt M tests/testcase/preconditions/rtHasMandatorySectionsTest.php M tests/testcase/preconditions/rtHasNoDuplicateSectionTest.php A tests/testcase/preconditions/rtHasNoEmptySectionsTest.php M tests/testcase/preconditions/rtIsSectionImplementedTest.php M tests/testcase/preconditions/rtIsValidSectionNameTest.php M tests/testcase/rtCleanExecutionTest.php M tests/testcase/rtCookieExecutionTest.php M tests/testcase/rtDeflatePostExecutionTest.php M tests/testcase/rtExpectHeadersExecutionTest.php M tests/testcase/rtFileExternalExecutionTest.php M tests/testcase/rtGetExecutionTest.php M tests/testcase/rtGzipPostExecutionTest.php M tests/testcase/rtPhpTestFileTest.php M tests/testcase/rtPostExecutionTest.php M tests/testcase/rtPostRawExecutionTest.php M tests/testcase/rtSkipIfExecutionTest.php M tests/testcase/rtTestExecutionTest.php M tests/testcase/rtTestOutputWriterTest.php M tests/testcase/rtTestResultsTest.php

diff --git a/src/rtClassMap.php b/src/rtClassMap.php index e2e3258..03bdc9e 100644 --- a/src/rtClassMap.php +++ b/src/rtClassMap.php @@ -64,6 +64,7 @@ $rtClassMap = array( 'rtTestOutputWriterXML' => 'testcase/output/rtTestOutputWriterXML.php', 'rtHasMandatorySections' => 'testcase/preconditions/rtHasMandatorySections.php', 'rtHasNoDuplicateSections' => 'testcase/preconditions/rtHasNoDuplicateSections.php', + 'rtHasNoEmptySections' => 'testcase/preconditions/rtHasNoEmptySections.php', 'rtIsSectionImplemented' => 'testcase/preconditions/rtIsSectionImplemented.php', 'rtIsValidSectionName' => 'testcase/preconditions/rtIsValidSectionName.php', 'rtPhpRunner' => 'testcase/rtPhpRunner.php', diff --git a/src/testcase/preconditions/rtHasMandatorySections.php b/src/testcase/preconditions/rtHasMandatorySections.php index 2b96ca8..a43ea15 100644 --- a/src/testcase/preconditions/rtHasMandatorySections.php +++ b/src/testcase/preconditions/rtHasMandatorySections.php @@ -31,12 +31,12 @@ class rtHasMandatorySections implements rtTestPreCondition * @param array $testCaseContents * @return boolean */ - public function isMet(array $sectionHeadings) + public function isMet(array $testContents, array $sectionHeaders) { - if (in_array('TEST', $sectionHeadings )) { - if (in_array('FILE', $sectionHeadings ) || in_array('FILEOF', $sectionHeadings) || in_array('FILE_EXTERNAL', $sectionHeadings)) { - if (in_array('EXPECT', $sectionHeadings ) || in_array('EXPECTF', $sectionHeadings) || in_array('EXPECTREGEX', $sectionHeadings)) { + if (in_array('TEST', $sectionHeaders )) { + if (in_array('FILE', $sectionHeaders ) || in_array('FILEOF', $sectionHeaders) || in_array('FILE_EXTERNAL', $sectionHeaders)) { + if (in_array('EXPECT', $sectionHeaders ) || in_array('EXPECTF', $sectionHeaders) || in_array('EXPECTREGEX', $sectionHeaders)) { return true; } } diff --git a/src/testcase/preconditions/rtHasNoDuplicateSections.php b/src/testcase/preconditions/rtHasNoDuplicateSections.php index 5f09753..975fbb8 100644 --- a/src/testcase/preconditions/rtHasNoDuplicateSections.php +++ b/src/testcase/preconditions/rtHasNoDuplicateSections.php @@ -28,14 +28,14 @@ class rtHasNoDuplicateSections implements rtTestPreCondition /** * Check that the PHP executable is a valid executable * - * @param array $testCaseContents + * @param array $testCaseContents, array $sectionHeaders * @return boolean */ - public function isMet(array $sectionHeadings) + public function isMet(array $testContents, array $sectionHeaders) { - $uniqueSections = array_unique($sectionHeadings); + $uniqueSections = array_unique($sectionHeaders); - if (count($uniqueSections) < count($sectionHeadings)) { + if (count($uniqueSections) < count($sectionHeaders)) { return false; } diff --git a/src/testcase/preconditions/rtHasNoEmptySections.php b/src/testcase/preconditions/rtHasNoEmptySections.php new file mode 100644 index 0000000..ba7b76b --- /dev/null +++ b/src/testcase/preconditions/rtHasNoEmptySections.php @@ -0,0 +1,54 @@ +<?php +/** + * rtHasNoEmptySections + * + * Checks that a section name is valid + * + * @category Testing + * @package RUNTESTS + * @author Zoe Slattery <zoe@php.net> + * @author Stefan Priebsch <spriebsch@php.net> + * @copyright 2009 The PHP Group + * @license http://www.php.net/license/3_01.txt PHP License 3.01 + * @link http://qa.php.net/ + * + */ +class rtHasNoEmptySections implements rtTestPreCondition +{ + private function isSectionHeading($string) { + return preg_match("/^--[A-Z]+(_[A-Z]+|)--/", $string); + } + + /** + * Return the message associated with an empty section + * + * @return text + */ + public function getMessage() + { + return rtText::get('emptySection'); + } + + /** + * Check that there is no empty section + * + * @param array $testCaseContents, array $sectionHeadings + * @return boolean + */ + public function isMet(array $testContents, array $sectionHeaders) + { + + + for ($i=0; $i<count($testContents) - 1; $i++) { + $nextLine = $testContents[$i+1]; + $thisLine = $testContents[$i]; + if ($this->isSectionHeading($thisLine)) { + if ($this->isSectionHeading($nextLine)) { + return false; + } + } + } + return true; + } +} +?> diff --git a/src/testcase/preconditions/rtIsSectionImplemented.php b/src/testcase/preconditions/rtIsSectionImplemented.php index 24567af..5fcd746 100644 --- a/src/testcase/preconditions/rtIsSectionImplemented.php +++ b/src/testcase/preconditions/rtIsSectionImplemented.php @@ -50,10 +50,10 @@ class rtIsSectionImplemented implements rtTestPreCondition /** * Check that the section has been implemented * - * @param array $testCaseContents + * @param array $testCaseContents, array $sectionHeaders * @return boolean */ - public function isMet(array $sectionHeaders) + public function isMet(array $testContents, array $sectionHeaders) { foreach ($sectionHeaders as $section) { if (!array_key_exists($section, $this->sectionMap)) { diff --git a/src/testcase/preconditions/rtIsValidSectionName.php b/src/testcase/preconditions/rtIsValidSectionName.php index 50cd734..0364594 100644 --- a/src/testcase/preconditions/rtIsValidSectionName.php +++ b/src/testcase/preconditions/rtIsValidSectionName.php @@ -55,12 +55,12 @@ class rtIsValidSectionName implements rtTestPreCondition /** * Check that the section name is valid * - * @param array $testCaseContents + * @param array $testCaseContents, array $sectionHeaders * @return boolean */ - public function isMet(array $sectionHeadings) + public function isMet(array $testContents, array $sectionHeaders) { - foreach ($sectionHeadings as $section) { + foreach ($sectionHeaders as $section) { if (!in_array($section, $this->validSectionNames)) { return false; } diff --git a/src/testcase/rtPhpTestFile.php b/src/testcase/rtPhpTestFile.php index e9a7306..dfc9de7 100644 --- a/src/testcase/rtPhpTestFile.php +++ b/src/testcase/rtPhpTestFile.php @@ -27,7 +27,8 @@ class rtPhpTestFile 'rtHasMandatorySections', 'rtHasNoDuplicateSections', 'rtIsValidSectionName', - 'rtIsSectionImplemented' + 'rtIsSectionImplemented', + 'rtHasNoEmptySections', ); private function isSectionHeading($string) { @@ -67,17 +68,18 @@ class rtPhpTestFile //Just trim the contents lines here not the section header lines if ($this->isSectionHeading($this->testContents[$i])) { $this->testContents[$i] = $this->getUntrimmedSectionHeading($this->testContents[$i]); + $this->sectionHeadings[] = $this->getSectionHeading($this->testContents[$i]); }else { $this->testContents[$i] = rtrim($this->testContents[$i], $this->carriageReturn.$this->newLine); } } } - /* + /* * Removes and discards any empty test sections * Constructs a list of section headingg, stripped of their -- identifiers. */ - public function removeEmptySections() { + /* public function removeEmptySections() { $tempArray = array(); for ($i=0; $i<count($this->testContents) - 1; $i++) { @@ -98,13 +100,13 @@ class rtPhpTestFile } $tempArray[] = end($this->testContents); $this->testContents = $tempArray; - } + }*/ public function arePreConditionsMet() { foreach ($this->preConditions as $preCondition) { $condition = new $preCondition; - if (!$condition->isMet($this->sectionHeadings)) { + if (!$condition->isMet($this->testContents, $this->sectionHeadings)) { $this->testExitMessage = $condition->getMessage(); return false; } diff --git a/src/testcase/rtTestPreCondition.php b/src/testcase/rtTestPreCondition.php index d11805f..bb61833 100644 --- a/src/testcase/rtTestPreCondition.php +++ b/src/testcase/rtTestPreCondition.php @@ -14,7 +14,7 @@ */ interface rtTestPreCondition { - public function isMet(array $testContents); + public function isMet(array $testContents, array $sectionHeaders); public function getMessage(); } diff --git a/src/testgroup/rtPhpTestGroup.php b/src/testgroup/rtPhpTestGroup.php index 94cfd69..200f4f9 100644 --- a/src/testgroup/rtPhpTestGroup.php +++ b/src/testgroup/rtPhpTestGroup.php @@ -41,7 +41,6 @@ class rtPhpTestGroup $testFile = new rtPhpTestFile(); $testFile->doRead($testFileName); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); //The test name is the full path to the test file name without the .phpt diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index eb3661f..b86f3e4 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -124,7 +124,6 @@ class rtPhpTestRun $testFile = new rtPhpTestFile(); $testFile->doRead($testName); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); // var_dump($testFile->getSectionHeadings()); // var_dump($testFile->getContents()); diff --git a/src/texts/emptySection.txt b/src/texts/emptySection.txt new file mode 100644 index 0000000..b5c0362 --- /dev/null +++ b/src/texts/emptySection.txt @@ -0,0 +1 @@ +The test has an empty section. \ No newline at end of file diff --git a/tests/testcase/preconditions/rtHasMandatorySectionsTest.php b/tests/testcase/preconditions/rtHasMandatorySectionsTest.php index 122d438..26a3d03 100644 --- a/tests/testcase/preconditions/rtHasMandatorySectionsTest.php +++ b/tests/testcase/preconditions/rtHasMandatorySectionsTest.php @@ -9,7 +9,7 @@ class rtHasMandatorySectionsTest extends PHPUnit_Framework_TestCase { $precondition = new rtHasMandatorySections(); $test = array('TEST','FILE', 'EXPECT'); - $this->assertTrue($precondition->isMet($test)); + $this->assertTrue($precondition->isMet(array(), $test)); } public function testHasNot() @@ -17,7 +17,7 @@ class rtHasMandatorySectionsTest extends PHPUnit_Framework_TestCase $precondition = new rtHasMandatorySections(); $test = array('TEST', 'FILE'); $this->assertEquals("The test case is missing one or more mandatory sections.", trim($precondition->getMessage())); - $this->assertFalse($precondition->isMet($test)); + $this->assertFalse($precondition->isMet(array(), $test)); } } ?> diff --git a/tests/testcase/preconditions/rtHasNoDuplicateSectionTest.php b/tests/testcase/preconditions/rtHasNoDuplicateSectionTest.php index ca885a7..a3579d1 100644 --- a/tests/testcase/preconditions/rtHasNoDuplicateSectionTest.php +++ b/tests/testcase/preconditions/rtHasNoDuplicateSectionTest.php @@ -10,7 +10,7 @@ class rtHasNoDuplicateSectionTest extends PHPUnit_Framework_TestCase $precondition = new rtHasNoDuplicateSections(); $test = array('TEST', 'FILE'); - $this->assertTrue($precondition->isMet($test)); + $this->assertTrue($precondition->isMet(array(), $test)); } public function testDup() @@ -19,7 +19,7 @@ class rtHasNoDuplicateSectionTest extends PHPUnit_Framework_TestCase $test = array('TEST', 'TEST'); $this->assertEquals("The test has duplicate sections.", trim($precondition->getMessage())); - $this->assertFalse($precondition->isMet($test)); + $this->assertFalse($precondition->isMet(array(), $test)); } } ?> diff --git a/tests/testcase/preconditions/rtHasNoEmptySectionsTest.php b/tests/testcase/preconditions/rtHasNoEmptySectionsTest.php new file mode 100644 index 0000000..148e27e --- /dev/null +++ b/tests/testcase/preconditions/rtHasNoEmptySectionsTest.php @@ -0,0 +1,26 @@ +<?php + +require_once 'PHPUnit/Framework.php'; +require_once dirname(__FILE__) . '../../../../src/rtAutoload.php'; + +class rthasNoEmptySectionsTest extends PHPUnit_Framework_TestCase +{ + public function testValid() + { + $precondition = new rtHasNoEmptySections(); + $test = array('--TEST--', 'something', '--FILE--', 'something', '--EXPECT--'); + + $this->assertTrue($precondition->isMet($test, array())); + } + + public function testInvalid() + { + $precondition = new rthasNoEmptySections(); + $test = array('--TEST--', 'something', '--FILE--', '--EXPECT--'); + + $this->assertEquals("The test has an empty section.", trim($precondition->getMessage())); + $this->assertFalse($precondition->isMet($test, array())); + } +} + +?> diff --git a/tests/testcase/preconditions/rtIsSectionImplementedTest.php b/tests/testcase/preconditions/rtIsSectionImplementedTest.php index 1f4bab7..24edc47 100644 --- a/tests/testcase/preconditions/rtIsSectionImplementedTest.php +++ b/tests/testcase/preconditions/rtIsSectionImplementedTest.php @@ -10,7 +10,7 @@ class rtIsSectionImplementedTest extends PHPUnit_Framework_TestCase $precondition = new rtIsSectionImplemented(); $test = array('TEST', 'FILE', 'EXPECT'); - $this->assertTrue($precondition->isMet($test)); + $this->assertTrue($precondition->isMet(array(), $test)); } public function testIsNot() @@ -19,7 +19,7 @@ class rtIsSectionImplementedTest extends PHPUnit_Framework_TestCase $test = array('UEXPECT', 'FILE'); $this->assertEquals("The test contains a section which is not implemented yet.", trim($precondition->getMessage())); - $this->assertFalse($precondition->isMet($test)); + $this->assertFalse($precondition->isMet(array(), $test)); } } ?> diff --git a/tests/testcase/preconditions/rtIsValidSectionNameTest.php b/tests/testcase/preconditions/rtIsValidSectionNameTest.php index daf6fd0..319b8fc 100644 --- a/tests/testcase/preconditions/rtIsValidSectionNameTest.php +++ b/tests/testcase/preconditions/rtIsValidSectionNameTest.php @@ -10,7 +10,7 @@ class rtIsValidSectionNameTest extends PHPUnit_Framework_TestCase $precondition = new rtIsValidSectionName(); $test = array('TEST', 'FILE'); - $this->assertTrue($precondition->isMet($test)); + $this->assertTrue($precondition->isMet(array(), $test)); } public function testInvalid() @@ -19,7 +19,7 @@ class rtIsValidSectionNameTest extends PHPUnit_Framework_TestCase $test = array('TEXT', 'FILE'); $this->assertEquals("Test case contains an invalid section.", trim($precondition->getMessage())); - $this->assertFalse($precondition->isMet($test)); + $this->assertFalse($precondition->isMet(array(), $test)); } } diff --git a/tests/testcase/rtCleanExecutionTest.php b/tests/testcase/rtCleanExecutionTest.php index 2f8bd91..6eaa32d 100644 --- a/tests/testcase/rtCleanExecutionTest.php +++ b/tests/testcase/rtCleanExecutionTest.php @@ -38,7 +38,7 @@ class rtCleanExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -66,8 +66,7 @@ class rtCleanExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); - + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config, $status); diff --git a/tests/testcase/rtCookieExecutionTest.php b/tests/testcase/rtCookieExecutionTest.php index 04e97b0..c0536b1 100644 --- a/tests/testcase/rtCookieExecutionTest.php +++ b/tests/testcase/rtCookieExecutionTest.php @@ -37,8 +37,7 @@ class rtCookieExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); - + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config, $status); diff --git a/tests/testcase/rtDeflatePostExecutionTest.php b/tests/testcase/rtDeflatePostExecutionTest.php index dc34d96..d0e5244 100644 --- a/tests/testcase/rtDeflatePostExecutionTest.php +++ b/tests/testcase/rtDeflatePostExecutionTest.php @@ -35,8 +35,7 @@ class rtDeflatePostExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); - + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config, $status); diff --git a/tests/testcase/rtExpectHeadersExecutionTest.php b/tests/testcase/rtExpectHeadersExecutionTest.php index d3de71d..b64b7aa 100644 --- a/tests/testcase/rtExpectHeadersExecutionTest.php +++ b/tests/testcase/rtExpectHeadersExecutionTest.php @@ -39,7 +39,7 @@ class rtExpectHeadersExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -69,7 +69,7 @@ class rtExpectHeadersExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtFileExternalExecutionTest.php b/tests/testcase/rtFileExternalExecutionTest.php index b014c70..4747ba7 100644 --- a/tests/testcase/rtFileExternalExecutionTest.php +++ b/tests/testcase/rtFileExternalExecutionTest.php @@ -37,8 +37,7 @@ class rtFileExternalExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); - + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $config, $status); @@ -64,7 +63,7 @@ class rtFileExternalExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -90,7 +89,7 @@ class rtFileExternalExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtGetExecutionTest.php b/tests/testcase/rtGetExecutionTest.php index 60859a0..2650178 100644 --- a/tests/testcase/rtGetExecutionTest.php +++ b/tests/testcase/rtGetExecutionTest.php @@ -37,7 +37,7 @@ class rtGetExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -68,7 +68,7 @@ class rtGetExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtGzipPostExecutionTest.php b/tests/testcase/rtGzipPostExecutionTest.php index f8762fe..3a6a6c2 100644 --- a/tests/testcase/rtGzipPostExecutionTest.php +++ b/tests/testcase/rtGzipPostExecutionTest.php @@ -35,7 +35,7 @@ class rtGzipPostExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtPhpTestFileTest.php b/tests/testcase/rtPhpTestFileTest.php index 8cbb4e9..adefa1d 100644 --- a/tests/testcase/rtPhpTestFileTest.php +++ b/tests/testcase/rtPhpTestFileTest.php @@ -27,7 +27,7 @@ class rtPhpTestFileTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($this->sample_test); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + $fileArray = $testFile->getContents(); $this->assertEquals('--TEST--', $fileArray[0]); @@ -39,7 +39,7 @@ class rtPhpTestFileTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($this->sample_windows_test); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + $fileArray = $testFile->getContents(); $fileString = implode(' ', $fileArray); @@ -58,7 +58,7 @@ class rtPhpTestFileTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($this->sample_test); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + $fileArray = $testFile->getContents(); $fileString = implode(' ', $fileArray); @@ -76,24 +76,9 @@ class rtPhpTestFileTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($this->sample_test); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + $this->assertTrue($testFile->arePreConditionsMet()); } - - public function testEmptySections() - { - $testFile = new rtPhpTestFile(); - $testFile->doRead($this->sample_es_test); - $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); - $fileArray = $testFile->getContents(); - - - - //Check that there are windows line endings in the original - $this->assertFalse(in_array('--GET--', $fileArray)); - - } } ?> diff --git a/tests/testcase/rtPostExecutionTest.php b/tests/testcase/rtPostExecutionTest.php index 18bd0f6..67c223b 100644 --- a/tests/testcase/rtPostExecutionTest.php +++ b/tests/testcase/rtPostExecutionTest.php @@ -35,7 +35,7 @@ class rtPostExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtPostRawExecutionTest.php b/tests/testcase/rtPostRawExecutionTest.php index e529dea..07dcd67 100644 --- a/tests/testcase/rtPostRawExecutionTest.php +++ b/tests/testcase/rtPostRawExecutionTest.php @@ -35,7 +35,7 @@ class rtPostRawExecutionTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtSkipIfExecutionTest.php b/tests/testcase/rtSkipIfExecutionTest.php index a4f0e44..7375108 100644 --- a/tests/testcase/rtSkipIfExecutionTest.php +++ b/tests/testcase/rtSkipIfExecutionTest.php @@ -32,7 +32,7 @@ class rtSkipIfExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtTestExecutionTest.php b/tests/testcase/rtTestExecutionTest.php index d8d66c3..b40c0e0 100644 --- a/tests/testcase/rtTestExecutionTest.php +++ b/tests/testcase/rtTestExecutionTest.php @@ -42,7 +42,7 @@ class rtTestExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -68,7 +68,7 @@ class rtTestExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -94,7 +94,7 @@ class rtTestExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -123,7 +123,7 @@ class rtTestExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -153,7 +153,7 @@ class rtTestExecutionTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtTestOutputWriterTest.php b/tests/testcase/rtTestOutputWriterTest.php index 4db1fbf..a11cbad 100644 --- a/tests/testcase/rtTestOutputWriterTest.php +++ b/tests/testcase/rtTestOutputWriterTest.php @@ -40,7 +40,7 @@ class rtTestOutputWriterTest extends PHPUnit_Framework_TestCase $testFile = new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); diff --git a/tests/testcase/rtTestResultsTest.php b/tests/testcase/rtTestResultsTest.php index 88a8954..e3dbcaf 100644 --- a/tests/testcase/rtTestResultsTest.php +++ b/tests/testcase/rtTestResultsTest.php @@ -43,7 +43,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -73,7 +73,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -103,7 +103,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -133,7 +133,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -166,7 +166,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -197,7 +197,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -227,7 +227,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + //Create a new test case $status = new rtTestStatus($testFile->getTestName()); @@ -258,7 +258,7 @@ class rtTestResultsTest extends PHPUnit_Framework_TestCase $testFile =new rtPhpTestFile(); $testFile->doRead($testFiles[0]); $testFile->normaliseLineEndings(); - $testFile->removeEmptySections(); + if (!$testFile->arePreConditionsMet()) { $testStatus = new rtTestStatus($testFile->getTestName());
« previous php.qa (#66321) next »