Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -61,9 +61,7 @@ |
62 | 62 | * Sets terminal colorization and diff/quick modes depending on OS and |
63 | 63 | * command-line options (--color and --quick). |
64 | 64 | */ |
65 | | - public function ParserTest() { |
66 | | - global $options; |
67 | | - |
| 65 | + public function ParserTest( $options = array() ) { |
68 | 66 | # Only colorize output if stdout is a terminal. |
69 | 67 | $this->color = !wfIsWindows() && posix_isatty( 1 ); |
70 | 68 | |
— | — | @@ -103,7 +101,7 @@ |
104 | 102 | $this->regex = ''; |
105 | 103 | } |
106 | 104 | |
107 | | - $this->setupRecorder(); |
| 105 | + $this->setupRecorder( $options ); |
108 | 106 | $this->keepUploads = isset( $options['keep-uploads'] ); |
109 | 107 | |
110 | 108 | if ( isset( $options['seed'] ) ) { |
— | — | @@ -116,10 +114,11 @@ |
117 | 115 | $this->functionHooks = array(); |
118 | 116 | } |
119 | 117 | |
120 | | - public function setupRecorder() { |
121 | | - global $options; |
| 118 | + public function setupRecorder ( $options ) { |
122 | 119 | if ( isset( $options['record'] ) ) { |
123 | 120 | $this->recorder = new DbTestRecorder( $this ); |
| 121 | + $this->recorder->version = isset( $options['setversion'] ) ? |
| 122 | + $options['setversion'] : SpecialVersion::getVersion(); |
124 | 123 | } elseif ( isset( $options['compare'] ) ) { |
125 | 124 | $this->recorder = new DbTestPreviewer( $this ); |
126 | 125 | } elseif ( isset( $options['upload'] ) ) { |
— | — | @@ -1438,12 +1437,14 @@ |
1439 | 1438 | } |
1440 | 1439 | |
1441 | 1440 | class DbTestRecorder extends DbTestPreviewer { |
| 1441 | + var $version; |
| 1442 | + |
1442 | 1443 | /** |
1443 | 1444 | * Set up result recording; insert a record for the run with the date |
1444 | 1445 | * and all that fun stuff |
1445 | 1446 | */ |
1446 | 1447 | function start() { |
1447 | | - global $wgDBtype, $options; |
| 1448 | + global $wgDBtype; |
1448 | 1449 | $this->db->begin(); |
1449 | 1450 | |
1450 | 1451 | if ( ! $this->db->tableExists( 'testrun' ) |
— | — | @@ -1464,8 +1465,7 @@ |
1465 | 1466 | $this->db->insert( 'testrun', |
1466 | 1467 | array( |
1467 | 1468 | 'tr_date' => $this->db->timestamp(), |
1468 | | - 'tr_mw_version' => isset( $options['setversion'] ) ? |
1469 | | - $options['setversion'] : SpecialVersion::getVersion(), |
| 1469 | + 'tr_mw_version' => $this->version, |
1470 | 1470 | 'tr_php_version' => phpversion(), |
1471 | 1471 | 'tr_db_version' => $this->db->getServerVersion(), |
1472 | 1472 | 'tr_uname' => php_uname() |
Index: trunk/phase3/maintenance/parserTests.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | # refer to $wgTitle directly, but instead use the title |
72 | 72 | # passed to it. |
73 | 73 | $wgTitle = Title::newFromText( 'Parser test script do not use' ); |
74 | | -$tester = new ParserTest(); |
| 74 | +$tester = new ParserTest($options); |
75 | 75 | |
76 | 76 | if ( isset( $options['file'] ) ) { |
77 | 77 | $files = array( $options['file'] ); |