com phpruntests: reverting changes to test parser: src/testcase/rtPhpTest.php
| From: | David Soria Parra | Date: | Thu, 02 Jul 2009 10:22:59 +0000 |
| Subject: | com phpruntests: reverting changes to test parser: src/testcase/rtPhpTest.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66374@lists.php.net to get a copy of this message | ||
Commit: 59ddd5070a2d28790547a6b8611beeed653b210f
Author: Zoe Slattery <zoe@php.net> Thu, 2 Jul 2009 10:22:59 +0000
Parents: a30f35f7d12e45015afa6583a6b375588de8911c
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=59ddd5070a2d28790547a6b8611beeed653b210f
Log:
reverting changes to test parser
Changed paths:
M src/testcase/rtPhpTest.php
Diff:
diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php
index 36f8fc1..dc33ad5 100644
--- a/src/testcase/rtPhpTest.php
+++ b/src/testcase/rtPhpTest.php
@@ -40,40 +40,29 @@ class rtPhpTest
*/
public function parse()
{
-
- for ($sectionCount = 0; $sectionCount < count ($this->sectionHeadings) -1 ;
$sectionCount++) {
-
- $sectionKey = $this->sectionHeadings[$sectionCount];
- $nextSectionKey = $this->sectionHeadings[$sectionCount + 1];
- $tempArray = array();
-
- $contentPointer = 0;
- for ($i=0; $i<count($this->contents); $i++) {
- if($this->contents[$i] == $sectionKey) {
- for ($j=$i+1; $j<count($this->contents); $j++) {
- if ($this->contents[$j] == $nextSectionKey ||
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;
- $contentPointer = $j;
- break;
+ for ($i=0; $i<count($this->contents); $i++) {
+ //Create an array of section objects
+ if ($this->isSectionKey($this->contents[$i])) {
+ $sectionKey = $this->contents[$i];
+
+ $tempArray = array();
+ for ($j=$i+1; $j<count($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]);
}
- $tempArray[] = $this->contents[$j];
+ $testSection = rtSection::getInstance($sectionKey, $tempArray);
+ $this->sections[$sectionKey] = $testSection;
+ break;
}
+ $tempArray[] = $this->contents[$j];
}
}
}
-
- $tempArray = array();
- for ($k = $contentPointer +1; $k < count($this->contents); $k++) {
- $tempArray[] = $this->contents[$k];
- }
- $testSection = rtSection::getInstance($nextSectionKey, $tempArray);
- $this->sections[$nextSectionKey] = $testSection;
+ $testSection = rtSection::getInstance($sectionKey, $tempArray);
+ $this->sections[$sectionKey] = $testSection;
//Identify the file and expect section types
@@ -82,23 +71,23 @@ class rtPhpTest
$this->fileSection->setExecutableFileName($this->getName());
}
-
+
/**
* Initialises the configuration for this test. Uses the configuration sections from teh test
case
- *
+ *
* @param rtRunTEstsConfiuration $runConfiguration
- *
+ *
*/
public function init(rtRuntestsConfiguration $runConfiguration)
{
$this->testConfiguration = new rtTestConfiguration($runConfiguration,
$this->sections, $this->sectionHeadings, $this->fileSection);
}
-
+
/**
* Executes the test case
- *
+ *
* @param rtRunTEstsConfiuration $runConfiguration
*/
public function executeTest(rtRuntestsConfiguration $runConfiguration)
@@ -130,7 +119,7 @@ class rtPhpTest
/**
* Test the output against the expect section
- *
+ *
*/
public function compareOutput()
{
@@ -143,10 +132,10 @@ class rtPhpTest
}
}
-
+
/**
* Test the expected headers against actual headers. Only relevant for CGI tests.
- *
+ *
*/
public function compareHeaders()
{
@@ -159,10 +148,10 @@ class rtPhpTest
}
}
-
+
/**
* Identify a section heading
- *
+ *
*/
private function isSectionKey($line)
{
@@ -191,7 +180,7 @@ class rtPhpTest
}
}
-
+
/**
* Sets the test's expect section
*/
@@ -234,9 +223,9 @@ class rtPhpTest
{
return $this->sections[$sectionKey];
}
-
+
/*
- * Return the object containing all test status
+ * Return the object containing all test status
*/
public function getStatus()
{