Fix bypassing hooks in TextContentTest
authorumherirrender <umherirrender_de.wp@web.de>
Wed, 15 Oct 2014 15:09:30 +0000 (17:09 +0200)
committerAddshore <addshorewiki@gmail.com>
Thu, 23 Oct 2014 17:46:55 +0000 (17:46 +0000)
Save the whole global $wgHooks with the default way instead of just a
hook in a own variable.

Change-Id: Ie796f7a53ee38e0dc07f5b026134bbdcb8c9fd53

tests/phpunit/includes/content/TextContentTest.php

index 2f81109..dd61f85 100644 (file)
@@ -7,11 +7,8 @@
  */
 class TextContentTest extends MediaWikiLangTestCase {
        protected $context;
-       protected $savedContentGetParserOutput;
 
        protected function setUp() {
-               global $wgHooks;
-
                parent::setUp();
 
                // Anon user
@@ -32,24 +29,8 @@ class TextContentTest extends MediaWikiLangTestCase {
                        'wgUseTidy' => false,
                        'wgAlwaysUseTidy' => false,
                        'wgCapitalLinks' => true,
+                       'wgHooks' => array(), // bypass hook ContentGetParserOutput that force custom rendering
                ) );
-
-               // bypass hooks that force custom rendering
-               if ( isset( $wgHooks['ContentGetParserOutput'] )  ) {
-                       $this->savedContentGetParserOutput = $wgHooks['ContentGetParserOutput'];
-                       unset( $wgHooks['ContentGetParserOutput'] );
-               }
-       }
-
-       public function teardown() {
-               global $wgHooks;
-
-               // restore hooks that force custom rendering
-               if ( $this->savedContentGetParserOutput !== null ) {
-                       $wgHooks['ContentGetParserOutput'] = $this->savedContentGetParserOutput;
-               }
-
-               parent::teardown();
        }
 
        public function newContent( $text ) {