X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2FtestHelpers.inc;h=62dccbf0b36ac4dd934bb0c1ff76d5ab00f80041;hb=abcb1a749ba9e654c5c23204dd7f2855dc19d392;hp=ea4d3c53d47e7d77154a42597b54982f8a466608;hpb=019e8ce29d5e94597bf7f50a2bc6ba8614e2bbe9;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index ea4d3c53d4..62dccbf0b3 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -36,23 +36,33 @@ */ interface ITestRecorder { - /** Called at beginning of the parser test run */ + /** + * Called at beginning of the parser test run + */ public function start(); - /** Called after each test */ + /** + * Called after each test + * @param string $test + * @param bool $result + */ public function record( $test, $result ); - /** Called before finishing the test run */ + /** + * Called before finishing the test run + */ public function report(); - /** Called at the end of the parser test run */ + /** + * Called at the end of the parser test run + */ public function end(); } class TestRecorder implements ITestRecorder { - var $parent; - var $term; + public $parent; + public $term; function __construct( $parent ) { $this->parent = $parent; @@ -107,6 +117,7 @@ class DbTestPreviewer extends TestRecorder { /** * This should be called before the table prefix is changed + * @param TestRecorder $parent */ function __construct( $parent ) { parent::__construct( $parent ); @@ -220,6 +231,9 @@ class DbTestPreviewer extends TestRecorder { * Returns a string giving information about when a test last had a status change. * Could help to track down when regressions were introduced, as distinct from tests * which have never passed (which are more change requests than regressions). + * @param string $testname + * @param string $after + * @return string */ private function getTestStatusInfo( $testname, $after ) { // If we're looking at a test that has just been removed, then say when it first appeared. @@ -295,7 +309,7 @@ class DbTestPreviewer extends TestRecorder { } class DbTestRecorder extends DbTestPreviewer { - var $version; + public $version; /** * Set up result recording; insert a record for the run with the date @@ -423,7 +437,7 @@ class TestFileIterator implements Iterator { $input = $this->checkSection( array( 'wikitext', 'input' ), false ); $result = $this->checkSection( array( 'html/php', 'html/*', 'html', 'result' ), false ); // some tests have "with tidy" and "without tidy" variants - $tidy = $this->checkSection( array( 'html/php+tidy', 'html+tidy'), false ); + $tidy = $this->checkSection( array( 'html/php+tidy', 'html+tidy' ), false ); if ( $tidy != false ) { if ( $this->nextSubTest == 0 ) { if ( $result != false ) { @@ -475,9 +489,11 @@ class TestFileIterator implements Iterator { function readNextTest() { # Run additional subtests of previous test - while ( $this->nextSubTest > 0 ) - if ( $this->setupCurrentTest() ) + while ( $this->nextSubTest > 0 ) { + if ( $this->setupCurrentTest() ) { return true; + } + } $this->clearSection(); # Reset hooks for the delayed test object @@ -554,8 +570,9 @@ class TestFileIterator implements Iterator { if ( $this->section == 'end' ) { $this->checkSection( 'test' ); do { - if ( $this->setupCurrentTest() ) + if ( $this->setupCurrentTest() ) { return true; + } } while ( $this->nextSubTest > 0 ); # go on to next test (since this was disabled) $this->clearSection(); @@ -596,10 +613,11 @@ class TestFileIterator implements Iterator { * Throw an exception if it is not set, referencing current section * and adding the current file name and line number * - * @param string|array $token Expected token(s) that should have been + * @param string|array $tokens Expected token(s) that should have been * mentioned before closing this section * @param bool $fatal True iff an exception should be thrown if * the section is not found. + * @return bool|string */ private function checkSection( $tokens, $fatal = true ) { if ( is_null( $this->section ) ) { @@ -672,6 +690,7 @@ class DelayedParserTest { * Called whenever we actually want to run the hook. * Should be the case if we found the parserTest is not disabled * @param ParserTest|NewParserTest $parserTest + * @return bool */ public function unleash( &$parserTest ) { if ( !( $parserTest instanceof ParserTest || $parserTest instanceof NewParserTest ) ) { @@ -728,7 +747,7 @@ class DelayedParserTest { /** * Similar to ParserTest object but does not run anything * Use unleash() to really execute the hook function - * @param string $fnHook + * @param string $hook */ public function requireTransparentHook( $hook ) { $this->transparentHooks[] = $hook;