X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fspecials%2FSpecialRecentchangesTest.php;h=cc16e5f7bd7fdd6e5e6d48b81578bbb99353e998;hb=816e6ded007382f35df38ea8f4b5a32e8e256b78;hp=c3d75aa58cebdd8c5d4765231a4cae2a379ce227;hpb=68e8c6ca53c2c59d265d01a9583de85161fbfff8;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php index c3d75aa58c..cc16e5f7bd 100644 --- a/tests/phpunit/includes/specials/SpecialRecentchangesTest.php +++ b/tests/phpunit/includes/specials/SpecialRecentchangesTest.php @@ -11,6 +11,11 @@ */ class SpecialRecentchangesTest extends MediaWikiTestCase { + protected function setUp() { + parent::setUp(); + $this->setMwGlobals( 'wgRCWatchCategoryMembership', true ); + } + /** * @var SpecialRecentChanges */ @@ -26,7 +31,7 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { $this->rc->setContext( $context ); $formOptions = $this->rc->setup( null ); - # Filter out rc_timestamp conditions which depends on the test runtime + #  Filter out rc_timestamp conditions which depends on the test runtime # This condition is not needed as of march 2, 2011 -- hashar # @todo FIXME: Find a way to generate the correct rc_timestamp $queryConditions = array_filter( @@ -48,27 +53,29 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { public function testRcNsFilter() { $this->assertConditions( - array( # expected + [ # expected 'rc_bot' => 0, - 0 => "rc_namespace = '0'", - ), - array( + 0 => "rc_type != '6'", + 1 => "rc_namespace = '0'", + ], + [ 'namespace' => NS_MAIN, - ), + ], "rc conditions with no options (aka default setting)" ); } public function testRcNsFilterInversion() { $this->assertConditions( - array( # expected + [ # expected 'rc_bot' => 0, - 0 => sprintf( "rc_namespace != '%s'", NS_MAIN ), - ), - array( + 0 => "rc_type != '6'", + 1 => sprintf( "rc_namespace != '%s'", NS_MAIN ), + ], + [ 'namespace' => NS_MAIN, 'invert' => 1, - ), + ], "rc conditions with namespace inverted" ); } @@ -79,14 +86,15 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { */ public function testRcNsFilterAssociation( $ns1, $ns2 ) { $this->assertConditions( - array( # expected + [ # expected 'rc_bot' => 0, - 0 => sprintf( "(rc_namespace = '%s' OR rc_namespace = '%s')", $ns1, $ns2 ), - ), - array( + 0 => "rc_type != '6'", + 1 => sprintf( "(rc_namespace = '%s' OR rc_namespace = '%s')", $ns1, $ns2 ), + ], + [ 'namespace' => $ns1, 'associated' => 1, - ), + ], "rc conditions with namespace inverted" ); } @@ -97,15 +105,16 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { */ public function testRcNsFilterAssociationWithInversion( $ns1, $ns2 ) { $this->assertConditions( - array( # expected + [ # expected 'rc_bot' => 0, - 0 => sprintf( "(rc_namespace != '%s' AND rc_namespace != '%s')", $ns1, $ns2 ), - ), - array( + 0 => "rc_type != '6'", + 1 => sprintf( "(rc_namespace != '%s' AND rc_namespace != '%s')", $ns1, $ns2 ), + ], + [ 'namespace' => $ns1, 'associated' => 1, 'invert' => 1, - ), + ], "rc conditions with namespace inverted" ); } @@ -115,9 +124,9 @@ class SpecialRecentchangesTest extends MediaWikiTestCase { * namespaces association filtering. */ public static function provideNamespacesAssociations() { - return array( # (NS => Associated_NS) - array( NS_MAIN, NS_TALK ), - array( NS_TALK, NS_MAIN ), - ); + return [ # (NS => Associated_NS) + [ NS_MAIN, NS_TALK ], + [ NS_TALK, NS_MAIN ], + ]; } }