com phpruntests: move ===done=== processing to parse()) in rtPhpTtest: src/testcase/rtPhpTest .php
src/testcase/sections/executablesections/rtFileSection .php tests/testcase/rtPhpTestTest.php
| From: | David Soria Parra | Date: | Sun, 17 May 2009 19:57:26 +0000 |
| Subject: | com phpruntests: move ===done=== processing to parse()) in rtPhpTtest: src/testcase/rtPhpTest .php src/testcase/sections/executablesections/rtFileSection .php tests/testcase/rtPhpTestTest.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66445@lists.php.net to get a copy of this message | ||
Commit: b55ff8f6fa67ab9eefbd2f831d2eb2d3bbe55a65
Author: Zoe Slattery <zoe@php.net> Sun, 17 May 2009 19:57:26 +0000
Parents: a89b8219cd861f13dc3517c9f5f783c21daf81e4
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=b55ff8f6fa67ab9eefbd2f831d2eb2d3bbe55a65
Log:
move ===done=== processing to parse()) in rtPhpTtest
Changed paths:
M src/testcase/rtPhpTest.php
M src/testcase/sections/executablesections/rtFileSection.php
M tests/testcase/rtPhpTestTest.php
Diff:
diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php
index f455857..8560bf3 100644
--- a/src/testcase/rtPhpTest.php
+++ b/src/testcase/rtPhpTest.php
@@ -44,7 +44,10 @@ class rtPhpTest
$tempArray = array();
for ($j=$i+1; $j<count($this->contents); $j++) {
- if ($this->isSectionKey($this->contents[$j])) {
+ if ($this->isSectionKey($this->contents[$j]) ||
stripos($this->contents[$j], "===done===") !== false) {
+ if(stripos($this->contents[$j], "===done===") !== false) {
+ $tempArray[] = trim($this->contents[$j]);
+ }
$testSection = rtSection::getInstance($sectionKey, $tempArray);
$this->sections[$sectionKey] = $testSection;
break;
@@ -56,6 +59,7 @@ class rtPhpTest
$testSection = rtSection::getInstance($sectionKey, $tempArray);
$this->sections[$sectionKey] = $testSection;
+
//Identify the file and expect section types
$this->fileSection = $this->setFileSection();
diff --git a/src/testcase/sections/executablesections/rtFileSection.php
b/src/testcase/sections/executablesections/rtFileSection.php
index 65d73a7..40883ff 100644
--- a/src/testcase/sections/executablesections/rtFileSection.php
+++ b/src/testcase/sections/executablesections/rtFileSection.php
@@ -23,16 +23,6 @@ class rtFileSection extends rtExecutableSection
}
protected function init() {
- $contents = array();
- foreach($this->sectionContents as $line) {
- if(stripos($line, "===done===") === false) {
- $contents[] = $line;
- } else {
- $contents[] = $line;
- $this->sectionContents = $contents;
- break;
- }
- }
}
public function run(rtPhpTest $testCase, rtRuntestsConfiguration $runConfiguration)
diff --git a/tests/testcase/rtPhpTestTest.php b/tests/testcase/rtPhpTestTest.php
index 315d8a1..5ad3011 100644
--- a/tests/testcase/rtPhpTestTest.php
+++ b/tests/testcase/rtPhpTestTest.php
@@ -15,6 +15,8 @@ class rtPhpTestTest extends PHPUnit_Framework_TestCase
'<?php',
' echo "hello world"; ',
'?>',
+ '===Done===',
+ 'blah blah blah',
'EXPECTF',
'hello world',
);
@@ -41,5 +43,16 @@ class rtPhpTestTest extends PHPUnit_Framework_TestCase
$this->assertEquals('rtFileSection',
get_class($test->getSection('FILE')));
$this->assertEquals('rtExpectFSection',
get_class($test->getSection('EXPECTF')));
}
+
+ public function testDone()
+ {
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php',
'-p', $this->php, 'test.phpt'));
+ $config->configure();
+
+ $test = new rtPhpTest($this->testCase, 'nameOfTest', array('TEST',
'FILE', 'EXPECTF'), $config);
+
+ // var_dump($test->getSection('FILE'));
+
+ }
}
?>