r70280 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70279‎ | r70280 | r70281 >
Date:18:03, 1 August 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Do not use directly the $options global
Modified paths:
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)
  • /trunk/phase3/maintenance/parserTests.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -61,9 +61,7 @@
6262 * Sets terminal colorization and diff/quick modes depending on OS and
6363 * command-line options (--color and --quick).
6464 */
65 - public function ParserTest() {
66 - global $options;
67 -
 65+ public function ParserTest( $options = array() ) {
6866 # Only colorize output if stdout is a terminal.
6967 $this->color = !wfIsWindows() && posix_isatty( 1 );
7068
@@ -103,7 +101,7 @@
104102 $this->regex = '';
105103 }
106104
107 - $this->setupRecorder();
 105+ $this->setupRecorder( $options );
108106 $this->keepUploads = isset( $options['keep-uploads'] );
109107
110108 if ( isset( $options['seed'] ) ) {
@@ -116,10 +114,11 @@
117115 $this->functionHooks = array();
118116 }
119117
120 - public function setupRecorder() {
121 - global $options;
 118+ public function setupRecorder ( $options ) {
122119 if ( isset( $options['record'] ) ) {
123120 $this->recorder = new DbTestRecorder( $this );
 121+ $this->recorder->version = isset( $options['setversion'] ) ?
 122+ $options['setversion'] : SpecialVersion::getVersion();
124123 } elseif ( isset( $options['compare'] ) ) {
125124 $this->recorder = new DbTestPreviewer( $this );
126125 } elseif ( isset( $options['upload'] ) ) {
@@ -1438,12 +1437,14 @@
14391438 }
14401439
14411440 class DbTestRecorder extends DbTestPreviewer {
 1441+ var $version;
 1442+
14421443 /**
14431444 * Set up result recording; insert a record for the run with the date
14441445 * and all that fun stuff
14451446 */
14461447 function start() {
1447 - global $wgDBtype, $options;
 1448+ global $wgDBtype;
14481449 $this->db->begin();
14491450
14501451 if ( ! $this->db->tableExists( 'testrun' )
@@ -1464,8 +1465,7 @@
14651466 $this->db->insert( 'testrun',
14661467 array(
14671468 'tr_date' => $this->db->timestamp(),
1468 - 'tr_mw_version' => isset( $options['setversion'] ) ?
1469 - $options['setversion'] : SpecialVersion::getVersion(),
 1469+ 'tr_mw_version' => $this->version,
14701470 'tr_php_version' => phpversion(),
14711471 'tr_db_version' => $this->db->getServerVersion(),
14721472 'tr_uname' => php_uname()
Index: trunk/phase3/maintenance/parserTests.php
@@ -70,7 +70,7 @@
7171 # refer to $wgTitle directly, but instead use the title
7272 # passed to it.
7373 $wgTitle = Title::newFromText( 'Parser test script do not use' );
74 -$tester = new ParserTest();
 74+$tester = new ParserTest($options);
7575
7676 if ( isset( $options['file'] ) ) {
7777 $files = array( $options['file'] );

Comments

#Comment by MarkAHershberger (talk | contribs)   23:59, 5 August 2010

causes problems with tests. See r70532

Status & tagging log