com phpruntests: doc blocks: src/testcase/rtPhpRunner.php src/testcase/rtPhpTest.php src/testcase/rtPhpTestFile.php
src/testcase/rtTestConfiguration.php src/testcase/rtTestDifference.php src/testcase/rtTestOutputWriter.php src/testcase/rtTestPreCondition.php
src/testcase/rtTestResults.php src/testgroup/rtPhpTestGroup.php src/testrun/rtPhpTestRun.php
| From: | David Soria Parra | Date: | Mon, 25 May 2009 12:30:44 +0000 |
| Subject: | com phpruntests: doc blocks: src/testcase/rtPhpRunner.php src/testcase/rtPhpTest.php src/testcase/rtPhpTestFile.php src/testcase/rtTestConfiguration.php src/testcase/rtTestDifference.php src/testcase/rtTestOutputWriter.php src/testcase/rtTestPreCondition.php src/testcase/rtTestResults.php src/testgroup/rtPhpTestGroup.php src/testrun/rtPhpTestRun.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66434@lists.php.net to get a copy of this message | ||
Commit: 062717d69e78ce2ceb8134d9a27c1d7d089a8df6
Author: Zoe Slattery <zoe@php.net> Mon, 25 May 2009 12:30:44 +0000
Parents: 1d56088ee10a957d61e276fd03badc2ffeac4a68
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=062717d69e78ce2ceb8134d9a27c1d7d089a8df6
Log:
doc blocks
Changed paths:
M src/testcase/rtPhpRunner.php
M src/testcase/rtPhpTest.php
M src/testcase/rtPhpTestFile.php
M src/testcase/rtTestConfiguration.php
M src/testcase/rtTestDifference.php
M src/testcase/rtTestOutputWriter.php
M src/testcase/rtTestPreCondition.php
M src/testcase/rtTestResults.php
M src/testgroup/rtPhpTestGroup.php
M src/testrun/rtPhpTestRun.php
diff --git a/src/testcase/rtPhpRunner.php b/src/testcase/rtPhpRunner.php index 31575db..e7aacb8 100644 --- a/src/testcase/rtPhpRunner.php +++ b/src/testcase/rtPhpRunner.php @@ -1,7 +1,17 @@ <?php /** - * Execution of PHP code. + * rtPhpRunner + * + * Runs PHP code * + * + * @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 rtPhpRunner { diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php index 8560bf3..2b0b399 100644 --- a/src/testcase/rtPhpTest.php +++ b/src/testcase/rtPhpTest.php @@ -1,5 +1,6 @@ <?php /** + * rtPhpTest * * This class represents a single phpt test case. * @@ -11,7 +12,6 @@ * @license http://www.php.net/license/3_01.txt PHP License 3.01 * */ - class rtPhpTest { public $testConfiguration; @@ -34,6 +34,9 @@ class rtPhpTest $this->init($runConfiguration); } + /** + * Creates a section object for each test section + */ public function parse() { for ($i=0; $i<count($this->contents); $i++) { @@ -67,13 +70,25 @@ 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); } + - //run + /** + * Executes the test case + * + * @param rtRunTEstsConfiuration $runConfiguration + */ public function executeTest(rtRuntestsConfiguration $runConfiguration) { $this->status = array(); @@ -103,6 +118,10 @@ class rtPhpTest } } + /** + * Test the output against the expect section + * + */ public function compareOutput() { $result = $this->expectSection->compare($this->output); @@ -114,6 +133,11 @@ class rtPhpTest } } + + /** + * Test the expected headers against actual headers. Only relevant for CGI tests. + * + */ public function compareHeaders() { $result = $this->sections['EXPECTHEADERS']->compare($this->headers); @@ -125,6 +149,11 @@ class rtPhpTest } } + + /** + * Identify a section heading + * + */ private function isSectionKey($line) { if (in_array($line, $this->sectionHeadings)) { @@ -134,6 +163,9 @@ class rtPhpTest } + /** + * Set the test's file section + */ private function setFileSection() { if (array_key_exists('FILE', $this->sections)) { @@ -149,6 +181,10 @@ class rtPhpTest } } + + /** + * Sets the test's expect section + */ private function setExpectSection() { if (array_key_exists('EXPECT', $this->sections)) { diff --git a/src/testcase/rtPhpTestFile.php b/src/testcase/rtPhpTestFile.php index c7da798..25c1162 100644 --- a/src/testcase/rtPhpTestFile.php +++ b/src/testcase/rtPhpTestFile.php @@ -1,6 +1,15 @@ <?php /** - * Class to deal with all file system operations for a test case + * rtPhpTestFile + * + * Reads the test file and checks pre-conditions + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtPhpTestFile diff --git a/src/testcase/rtTestConfiguration.php b/src/testcase/rtTestConfiguration.php index a594eab..b7772c4 100644 --- a/src/testcase/rtTestConfiguration.php +++ b/src/testcase/rtTestConfiguration.php @@ -13,8 +13,6 @@ * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @link http://qa.php.net/ */ - - class rtTestConfiguration { private $environmentVariables; diff --git a/src/testcase/rtTestDifference.php b/src/testcase/rtTestDifference.php index 975fb4b..94589ec 100644 --- a/src/testcase/rtTestDifference.php +++ b/src/testcase/rtTestDifference.php @@ -1,6 +1,16 @@ <?php /** - * Calculates the difference between the expected and actual output + * rtTestDifference + * + * Calculates difference between actual and expected output. + * Exact import from run-tests.php + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtTestDifference diff --git a/src/testcase/rtTestOutputWriter.php b/src/testcase/rtTestOutputWriter.php index 62149c7..0805895 100644 --- a/src/testcase/rtTestOutputWriter.php +++ b/src/testcase/rtTestOutputWriter.php @@ -1,6 +1,16 @@ <?php /** - * Class for writing the output from a test + * rtTestOutputWriter + * + * Writes test output. This is concerned with status (PASS, FAIL etc) not + * with the log files. + * + * @category Quality Assurance + * @package run-tests + * @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 * */ abstract class rtTestOutputWriter diff --git a/src/testcase/rtTestPreCondition.php b/src/testcase/rtTestPreCondition.php index a2822b3..61ea7a9 100644 --- a/src/testcase/rtTestPreCondition.php +++ b/src/testcase/rtTestPreCondition.php @@ -1,5 +1,17 @@ <?php - +/** + * rtTestPreCondition + * + * Parent class for test case pre-conditions + * + * @category Quality Assurance + * @package run-tests + * @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 + * + */ interface rtTestPreCondition { public function isMet(array $testContents); diff --git a/src/testcase/rtTestResults.php b/src/testcase/rtTestResults.php index 2785080..fbaaf22 100644 --- a/src/testcase/rtTestResults.php +++ b/src/testcase/rtTestResults.php @@ -1,5 +1,7 @@ <?php /** + * rtTestResults + * * Class to store test results. * * Ensures that files are either deleted or saved depending on the test results @@ -7,6 +9,13 @@ * Maintains (adds to) the tests case status to give a final status array * Request calculation of difference between expected/actual output if the test has failed. * + * @category Quality Assurance + * @package run-tests + * @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 + * */ class rtTestResults { diff --git a/src/testgroup/rtPhpTestGroup.php b/src/testgroup/rtPhpTestGroup.php index 26031ca..11d4c1a 100644 --- a/src/testgroup/rtPhpTestGroup.php +++ b/src/testgroup/rtPhpTestGroup.php @@ -1,7 +1,16 @@ <?php /** + * rtTestGroup + * * Runs a 'group of tests'. A 'group' is all or the tests in a single directory. * + * @category Quality Assurance + * @package run-tests + * @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 + * */ class rtPhpTestGroup { diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index fc2b756..18abe0c 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -1,6 +1,15 @@ <?php /** - * Main class for a test run + * rtTestRun + * + * Main class for a single test run + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtPhpTestRun
diff --git a/src/testcase/rtPhpRunner.php b/src/testcase/rtPhpRunner.php index 31575db..e7aacb8 100644 --- a/src/testcase/rtPhpRunner.php +++ b/src/testcase/rtPhpRunner.php @@ -1,7 +1,17 @@ <?php /** - * Execution of PHP code. + * rtPhpRunner + * + * Runs PHP code * + * + * @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 rtPhpRunner { diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php index 8560bf3..2b0b399 100644 --- a/src/testcase/rtPhpTest.php +++ b/src/testcase/rtPhpTest.php @@ -1,5 +1,6 @@ <?php /** + * rtPhpTest * * This class represents a single phpt test case. * @@ -11,7 +12,6 @@ * @license http://www.php.net/license/3_01.txt PHP License 3.01 * */ - class rtPhpTest { public $testConfiguration; @@ -34,6 +34,9 @@ class rtPhpTest $this->init($runConfiguration); } + /** + * Creates a section object for each test section + */ public function parse() { for ($i=0; $i<count($this->contents); $i++) { @@ -67,13 +70,25 @@ 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); } + - //run + /** + * Executes the test case + * + * @param rtRunTEstsConfiuration $runConfiguration + */ public function executeTest(rtRuntestsConfiguration $runConfiguration) { $this->status = array(); @@ -103,6 +118,10 @@ class rtPhpTest } } + /** + * Test the output against the expect section + * + */ public function compareOutput() { $result = $this->expectSection->compare($this->output); @@ -114,6 +133,11 @@ class rtPhpTest } } + + /** + * Test the expected headers against actual headers. Only relevant for CGI tests. + * + */ public function compareHeaders() { $result = $this->sections['EXPECTHEADERS']->compare($this->headers); @@ -125,6 +149,11 @@ class rtPhpTest } } + + /** + * Identify a section heading + * + */ private function isSectionKey($line) { if (in_array($line, $this->sectionHeadings)) { @@ -134,6 +163,9 @@ class rtPhpTest } + /** + * Set the test's file section + */ private function setFileSection() { if (array_key_exists('FILE', $this->sections)) { @@ -149,6 +181,10 @@ class rtPhpTest } } + + /** + * Sets the test's expect section + */ private function setExpectSection() { if (array_key_exists('EXPECT', $this->sections)) { diff --git a/src/testcase/rtPhpTestFile.php b/src/testcase/rtPhpTestFile.php index c7da798..25c1162 100644 --- a/src/testcase/rtPhpTestFile.php +++ b/src/testcase/rtPhpTestFile.php @@ -1,6 +1,15 @@ <?php /** - * Class to deal with all file system operations for a test case + * rtPhpTestFile + * + * Reads the test file and checks pre-conditions + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtPhpTestFile diff --git a/src/testcase/rtTestConfiguration.php b/src/testcase/rtTestConfiguration.php index a594eab..b7772c4 100644 --- a/src/testcase/rtTestConfiguration.php +++ b/src/testcase/rtTestConfiguration.php @@ -13,8 +13,6 @@ * @license http://www.php.net/license/3_01.txt PHP License 3.01 * @link http://qa.php.net/ */ - - class rtTestConfiguration { private $environmentVariables; diff --git a/src/testcase/rtTestDifference.php b/src/testcase/rtTestDifference.php index 975fb4b..94589ec 100644 --- a/src/testcase/rtTestDifference.php +++ b/src/testcase/rtTestDifference.php @@ -1,6 +1,16 @@ <?php /** - * Calculates the difference between the expected and actual output + * rtTestDifference + * + * Calculates difference between actual and expected output. + * Exact import from run-tests.php + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtTestDifference diff --git a/src/testcase/rtTestOutputWriter.php b/src/testcase/rtTestOutputWriter.php index 62149c7..0805895 100644 --- a/src/testcase/rtTestOutputWriter.php +++ b/src/testcase/rtTestOutputWriter.php @@ -1,6 +1,16 @@ <?php /** - * Class for writing the output from a test + * rtTestOutputWriter + * + * Writes test output. This is concerned with status (PASS, FAIL etc) not + * with the log files. + * + * @category Quality Assurance + * @package run-tests + * @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 * */ abstract class rtTestOutputWriter diff --git a/src/testcase/rtTestPreCondition.php b/src/testcase/rtTestPreCondition.php index a2822b3..61ea7a9 100644 --- a/src/testcase/rtTestPreCondition.php +++ b/src/testcase/rtTestPreCondition.php @@ -1,5 +1,17 @@ <?php - +/** + * rtTestPreCondition + * + * Parent class for test case pre-conditions + * + * @category Quality Assurance + * @package run-tests + * @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 + * + */ interface rtTestPreCondition { public function isMet(array $testContents); diff --git a/src/testcase/rtTestResults.php b/src/testcase/rtTestResults.php index 2785080..fbaaf22 100644 --- a/src/testcase/rtTestResults.php +++ b/src/testcase/rtTestResults.php @@ -1,5 +1,7 @@ <?php /** + * rtTestResults + * * Class to store test results. * * Ensures that files are either deleted or saved depending on the test results @@ -7,6 +9,13 @@ * Maintains (adds to) the tests case status to give a final status array * Request calculation of difference between expected/actual output if the test has failed. * + * @category Quality Assurance + * @package run-tests + * @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 + * */ class rtTestResults { diff --git a/src/testgroup/rtPhpTestGroup.php b/src/testgroup/rtPhpTestGroup.php index 26031ca..11d4c1a 100644 --- a/src/testgroup/rtPhpTestGroup.php +++ b/src/testgroup/rtPhpTestGroup.php @@ -1,7 +1,16 @@ <?php /** + * rtTestGroup + * * Runs a 'group of tests'. A 'group' is all or the tests in a single directory. * + * @category Quality Assurance + * @package run-tests + * @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 + * */ class rtPhpTestGroup { diff --git a/src/testrun/rtPhpTestRun.php b/src/testrun/rtPhpTestRun.php index fc2b756..18abe0c 100644 --- a/src/testrun/rtPhpTestRun.php +++ b/src/testrun/rtPhpTestRun.php @@ -1,6 +1,15 @@ <?php /** - * Main class for a test run + * rtTestRun + * + * Main class for a single test run + * + * @category Quality Assurance + * @package run-tests + * @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 * */ class rtPhpTestRun