Fix setting hooks in ApiQueryTest
authorumherirrender <umherirrender_de.wp@web.de>
Wed, 15 Oct 2014 15:50:36 +0000 (17:50 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Wed, 15 Oct 2014 15:50:36 +0000 (17:50 +0200)
Also fix the comment

Change-Id: I4245a5f515980c743965996aecc67b42b616b50c

tests/phpunit/includes/api/query/ApiQueryTest.php

index bba22c7..200027d 100644 (file)
@@ -7,32 +7,21 @@
  * @covers ApiQuery
  */
 class ApiQueryTest extends ApiTestCase {
-       /**
-        * @var array Storage for $wgHooks
-        */
-       protected $hooks;
-
        protected function setUp() {
-               global $wgHooks;
-
                parent::setUp();
                $this->doLogin();
 
-               // Setup en: as interwiki prefix
-               $this->hooks = $wgHooks;
-               $wgHooks['InterwikiLoadPrefix'][] = function ( $prefix, &$data ) {
-                       if ( $prefix == 'apiquerytestiw' ) {
-                               $data = array( 'iw_url' => 'wikipedia' );
-                       }
-                       return false;
-               };
-       }
-
-       protected function tearDown() {
-               global $wgHooks;
-               $wgHooks = $this->hooks;
-
-               parent::tearDown();
+               // Setup apiquerytestiw: as interwiki prefix
+               $this->setMwGlobals( 'wgHooks', array(
+                       'InterwikiLoadPrefix' => array(
+                               function ( $prefix, &$data ) {
+                                       if ( $prefix == 'apiquerytestiw' ) {
+                                               $data = array( 'iw_url' => 'wikipedia' );
+                                       }
+                                       return false;
+                               }
+                       )
+               ) );
        }
 
        public function testTitlesGetNormalized() {