com phpruntests: Implementing REDIRECT TEST. Get list of testcases back to PhpRun class: src/rtClassMap.php src/taskScheduler/rtTaskScheduler.php
src/taskScheduler/rtTaskTestGroup.php src/testcase/preconditions/rtIsValidSectionName.php
src/testcase/sections/configurationsections/rtRedirectSection.php src/testcase/sections/rtSection.php src/testgroup/rtPhpTestGroup.php
src/testrun/rtPhpTestRun.php

From: Date: Sun, 20 May 2012 12:09:28 +0000
Subject: com phpruntests: Implementing REDIRECT TEST. Get list of testcases back to PhpRun class: src/rtClassMap.php src/taskScheduler/rtTaskScheduler.php
src/taskScheduler/rtTaskTestGroup.php src/testcase/preconditions/rtIsValidSectionName.php
src/testcase/sections/configurationsections/rtRedirectSection.php src/testcase/sections/rtSection.php src/testgroup/rtPhpTestGroup.php
src/testrun/rtPhpTestRun.php
Groups: php.qa 
Request: Send a blank email to php-qa+get-66585@lists.php.net to get a copy of this message
Commit: 24d08e775107faf433cff1a9f862994ecae7c028 Author: zoe slattery <zoe@php.net> Sun, 20 May 2012 13:09:28 +0100 Parents: 6232592cbf3a7575b92fa43d5fc790bc6bedd2b6 Branches: master Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=24d08e775107faf433cff1a9f862994ecae7c028 Log: Implementing REDIRECT TEST. Get list of testcases back to PhpRun class Changed paths: M src/rtClassMap.php M src/taskScheduler/rtTaskScheduler.php M src/taskScheduler/rtTaskTestGroup.php M src/testcase/preconditions/rtIsValidSectionName.php A src/testcase/sections/configurationsections/rtRedirectSection.php M src/testcase/sections/rtSection.php M src/testgroup/rtPhpTestGroup.php M src/testrun/rtPhpTestRun.php

diff --git a/src/rtClassMap.php b/src/rtClassMap.php index adf25d7..79eb583 100644 --- a/src/rtClassMap.php +++ b/src/rtClassMap.php @@ -80,6 +80,7 @@ $rtClassMap = array( 'rtIniSection' => 'testcase/sections/configurationsections/rtIniSection.php', 'rtPostRawSection' => 'testcase/sections/configurationsections/rtPostRawSection.php', 'rtPostSection' => 'testcase/sections/configurationsections/rtPostSection.php', + 'rtRedirectSection' => 'testcase/sections/configurationsections/rtRedirectSection.php', 'rtStdinSection' => 'testcase/sections/configurationsections/rtStdinSection.php', 'rtCleanSection' => 'testcase/sections/executablesections/rtCleanSection.php', 'rtFileExternalSection' => 'testcase/sections/executablesections/rtFileExternalSection.php', diff --git a/src/taskScheduler/rtTaskScheduler.php b/src/taskScheduler/rtTaskScheduler.php index ff3569c..99bcc96 100644 --- a/src/taskScheduler/rtTaskScheduler.php +++ b/src/taskScheduler/rtTaskScheduler.php @@ -19,6 +19,7 @@ class rtTaskScheduler protected $resultList = array(); // list of results protected $processCount = 0; // the number of processes protected $reportStatus = 0; // reprort-status + protected $redirectedTestCases = array(); /** @@ -132,10 +133,15 @@ class rtTaskScheduler $results = $task->getResult(); rtTestOutputWriter::flushResult($results, $this->reportStatus); $this->resultList[] = $results; + $this->redirectedTestCases[] = $task->getRedirectedTestCases(); } return; } + + public function getRedirectedTestCases() { + return $this->redirectedTestCases; + } } diff --git a/src/taskScheduler/rtTaskTestGroup.php b/src/taskScheduler/rtTaskTestGroup.php index 078a10c..5c89b65 100644 --- a/src/taskScheduler/rtTaskTestGroup.php +++ b/src/taskScheduler/rtTaskTestGroup.php @@ -15,6 +15,7 @@ class rtTaskTestGroup extends rtTask implements rtTaskInterface { protected $runConfiguration; protected $subDirectory; + protected $redirectedTestCases = array(); public function __construct($runConfiguration, $subDirectory) @@ -33,8 +34,13 @@ class rtTaskTestGroup extends rtTask implements rtTaskInterface $testGroup = new rtPhpTestGroup($this->runConfiguration, $this->subDirectory); $testGroup->runGroup($this->runConfiguration); $this->result = $testGroup->getResults(); + $this->redirectedTestCases = $testGroup->getRedirectedTestCases(); return true; } + + public function getRedirectedTestCases() { + return $this->redirectedTestCases; + } } diff --git a/src/testcase/preconditions/rtIsValidSectionName.php b/src/testcase/preconditions/rtIsValidSectionName.php index be5cd23..d3938a4 100644 --- a/src/testcase/preconditions/rtIsValidSectionName.php +++ b/src/testcase/preconditions/rtIsValidSectionName.php @@ -42,7 +42,6 @@ class rtIsValidSectionName implements rtTestPreCondition 'GET', 'COOKIE', 'REDIRECTTEST', - 'HEADERS', 'EXPECTHEADERS', ); diff --git a/src/testcase/sections/configurationsections/rtRedirectSection.php b/src/testcase/sections/configurationsections/rtRedirectSection.php new file mode 100644 index 0000000..36dc229 --- /dev/null +++ b/src/testcase/sections/configurationsections/rtRedirectSection.php @@ -0,0 +1,11 @@ +<?php +class rtRedirectSection extends rtConfigurationSection +{ + + protected function init() + { + + } + +} +?> diff --git a/src/testcase/sections/rtSection.php b/src/testcase/sections/rtSection.php index 79579bc..659de31 100644 --- a/src/testcase/sections/rtSection.php +++ b/src/testcase/sections/rtSection.php @@ -38,6 +38,7 @@ abstract class rtSection 'COOKIE' => 'rtCookieSection', 'FILE_EXTERNAL' => 'rtFileExternalSection', 'EXPECTHEADERS' => 'rtExpectHeadersSection', + 'REDIRECTTEST' => 'rtRedirectSection', ); protected $sectionName; @@ -58,9 +59,9 @@ abstract class rtSection abstract protected function init(); public static function getInstance($sectionName, $contents, $testName) - { - + { if (!isset(self::$sectionMap[$sectionName])) { + var_dump($testName); throw new rtException('Unknown section type ' . $sectionName); } diff --git a/src/testgroup/rtPhpTestGroup.php b/src/testgroup/rtPhpTestGroup.php index 62d6cd3..5203656 100644 --- a/src/testgroup/rtPhpTestGroup.php +++ b/src/testgroup/rtPhpTestGroup.php @@ -17,6 +17,7 @@ class rtPhpTestGroup protected $testDirectory; protected $testCases; protected $results; + protected $redirectedTestCases = array(); public function __construct(rtRuntestsConfiguration $runConfiguration, $directory) { @@ -45,12 +46,13 @@ class rtPhpTestGroup //The test name is the full path to the test file name without the .phpt $testStatus = new rtTestStatus($testFile->getTestName()); - if ($testFile->arePreconditionsMet() ) { - // Create a new test case - + // Create a new test case $this->testCases[] = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $runConfiguration, $testStatus); - } else { + } elseif (in_array("REDIRECTTEST",$testFile->getSectionHeadings())){ + //Redirect handler, save the test case for processing after the main groups have finished. + $this->redirectedTestCases[] = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $runConfiguration, $testStatus); + }else { $testStatus->setTrue('bork'); $testStatus->setMessage('bork', $testFile->getExitMessage()); $this->results[] = new rtTestResults(null, $testStatus); @@ -84,6 +86,10 @@ class rtPhpTestGroup { return $this->results; } + + public function getRedirectedTestCases() { + return $this->redirectedTestCases; + } } ?> diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index 929dd31..1ab880b 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -99,6 +99,16 @@ class rtPhpTestRun $resultList = $scheduler->getResultList(); + //Check to see if there are any redirected tests. + + $redirects = $scheduler->getRedirectedTestCases(); + + for($i=0; $i<sizeof($subDirectories); $i++) { + foreach($redirects[$i] as $redirectedTestCase) { + echo "\nTest not executed, requires redirect. : ".$redirectedTestCase->getName(); + } + } + // create output $type = null; if ($runConfiguration->hasCommandLineOption('o')) { @@ -151,6 +161,13 @@ class rtPhpTestRun $results = new rtTestResults($testCase); $results->processResults($testCase, $runConfiguration); + } elseif (in_array("REDIRECTTEST", $testFile->getSectionHeadings())) { + //Redirect handler + $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(), $testFile->getSectionHeadings(), $runConfiguration, $testStatus); + echo "Not executed, will need to redirect: ".$testCase->getName()."\n"; + $testStatus->setTrue('bork'); + $testStatus->setMessage('bork', $testFile->getExitMessage()); + $results = new rtTestResults(null, $testStatus); } else { $testStatus->setTrue('bork'); $testStatus->setMessage('bork', $testFile->getExitMessage());
« previous php.qa (#66585) next »