r94244 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94243‎ | r94244 | r94245 >
Date:14:13, 11 August 2011
Author:ialex
Status:ok
Tags:
Comment:
Make SpecialRecentchangesTest pass
Modified paths:
  • /trunk/phase3/tests/phpunit/includes/specials/SpecialRecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/specials/SpecialRecentchanges.php
@@ -18,13 +18,12 @@
1919
2020 /** helper to test SpecialRecentchanges::buildMainQueryConds() */
2121 private function assertConditions( $expected, $requestOptions = null, $message = '' ) {
22 - global $wgRequest;
23 - $savedGlobal = $wgRequest;
 22+ $context = new RequestContext;
 23+ $context->setRequest( new FauxRequest( $requestOptions ) );
2424
25 - # Initialize a WebRequest object ...
26 - $wgRequest = new FauxRequest( $requestOptions );
27 - # ... then setup the rc object (which use wgRequest internally)
 25+ # setup the rc object
2826 $this->rc = new SpecialRecentChanges();
 27+ $this->rc->setContext( $context );
2928 $formOptions = $this->rc->setup( null );
3029
3130 # Filter out rc_timestamp conditions which depends on the test runtime
@@ -40,8 +39,6 @@
4140 $queryConditions,
4241 $message
4342 );
44 -
45 - $wgRequest = $savedGlobal;
4643 }
4744
4845 /** return false if condition begin with 'rc_timestamp ' */
@@ -88,7 +85,7 @@
8986 array( # expected
9087 #0 => "rc_timestamp >= '20110223000000'",
9188 'rc_bot' => 0,
92 - 1 => sprintf( "(rc_namespace = '%s' OR rc_namespace = '%s')", $ns1, $ns2 ),
 89+ 1 => sprintf( "rc_namespace IN ('%s','%s')", $ns1, $ns2 ),
9390 ),
9491 array(
9592 'namespace' => $ns1,
@@ -107,7 +104,7 @@
108105 array( # expected
109106 #0 => "rc_timestamp >= '20110223000000'",
110107 'rc_bot' => 0,
111 - 1 => sprintf( "(rc_namespace != '%s' AND rc_namespace != '%s')", $ns1, $ns2 ),
 108+ 1 => sprintf( "rc_namespace NOT IN ('%s','%s')", $ns1, $ns2 ),
112109 ),
113110 array(
114111 'namespace' => $ns1,

Status & tagging log