Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -327,7 +327,23 @@ |
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
| 331 | + |
331 | 332 | /** |
| 333 | + * Use a regex to find out the value of an option |
| 334 | + * @param $regex A regex, the first group will be the value returned |
| 335 | + * @param $opts Options line to look in |
| 336 | + * @param $defaults Default value returned if the regex does not match |
| 337 | + */ |
| 338 | + private static function getOptionValue( $regex, $opts, $default ) { |
| 339 | + $m = array(); |
| 340 | + if( preg_match( $regex, $opts, $m ) ) { |
| 341 | + return $m[1]; |
| 342 | + } else { |
| 343 | + return $default; |
| 344 | + } |
| 345 | + } |
| 346 | + |
| 347 | + /** |
332 | 348 | * Set up the global variables for a consistent environment for each test. |
333 | 349 | * Ideally this should replace the global configuration entirely. |
334 | 350 | */ |
— | — | @@ -342,20 +358,14 @@ |
343 | 359 | $this->uploadDir = $this->setupUploadDir(); |
344 | 360 | } |
345 | 361 | |
346 | | - $m = array(); |
347 | | - if( preg_match( '/language=([a-z]+(?:_[a-z]+)?)/', $opts, $m ) ) { |
348 | | - $lang = $m[1]; |
349 | | - } else { |
350 | | - $lang = 'en'; |
351 | | - } |
| 362 | + # Find out values for some special options. |
| 363 | + $lang = |
| 364 | + self::getOptionValue( '/language=([a-z]+(?:_[a-z]+)?)/', $opts, 'en' ); |
| 365 | + $variant = |
| 366 | + self::getOptionValue( '/variant=([a-z]+(?:-[a-z]+)?)/', $opts, false ); |
| 367 | + $maxtoclevel = |
| 368 | + self::getOptionValue( '/wgMaxTocLevel=(\d+)/', $opts, 999 ); |
352 | 369 | |
353 | | - if( preg_match( '/variant=([a-z]+(?:-[a-z]+)?)/', $opts, $m ) ) { |
354 | | - $variant = $m[1]; |
355 | | - } else { |
356 | | - $variant = false; |
357 | | - } |
358 | | - |
359 | | - |
360 | 370 | $settings = array( |
361 | 371 | 'wgServer' => 'http://localhost', |
362 | 372 | 'wgScript' => '/index.php', |
— | — | @@ -374,7 +384,7 @@ |
375 | 385 | 'wgLang' => null, |
376 | 386 | 'wgContLang' => null, |
377 | 387 | 'wgNamespacesWithSubpages' => array( 0 => preg_match('/\\bsubpage\\b/i', $opts)), |
378 | | - 'wgMaxTocLevel' => 999, |
| 388 | + 'wgMaxTocLevel' => $maxtoclevel, |
379 | 389 | 'wgCapitalLinks' => true, |
380 | 390 | 'wgNoFollowLinks' => true, |
381 | 391 | 'wgThumbnailScriptPath' => false, |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -34,7 +34,9 @@ |
35 | 35 | |
36 | 36 | == Maintenance script changes since 1.10 == |
37 | 37 | |
| 38 | +* Add support for wgMaxTocLevel option in parserTests |
38 | 39 | |
| 40 | + |
39 | 41 | == Languages updated since 1.10 == |
40 | 42 | |
41 | 43 | * Arabic (ar) |