Umherirrender has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/166759

Change subject: Fix setting hooks in ApiQueryTest
......................................................................

Fix setting hooks in ApiQueryTest

Also fix the comment

Change-Id: I4245a5f515980c743965996aecc67b42b616b50c
---
M tests/phpunit/includes/api/query/ApiQueryTest.php
1 file changed, 11 insertions(+), 22 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/59/166759/1

diff --git a/tests/phpunit/includes/api/query/ApiQueryTest.php 
b/tests/phpunit/includes/api/query/ApiQueryTest.php
index bba22c7..200027d 100644
--- a/tests/phpunit/includes/api/query/ApiQueryTest.php
+++ b/tests/phpunit/includes/api/query/ApiQueryTest.php
@@ -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() {

-- 
To view, visit https://gerrit.wikimedia.org/r/166759
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4245a5f515980c743965996aecc67b42b616b50c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <umherirrender_de...@web.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to