Merge "Add new grammar forms for language names in Russian"
[lhc/web/wiklou.git] / tests / phpunit / includes / content / TextContentTest.php
index 2f81109..06609d8 100644 (file)
@@ -7,11 +7,8 @@
  */
 class TextContentTest extends MediaWikiLangTestCase {
        protected $context;
-       protected $savedContentGetParserOutput;
 
        protected function setUp() {
-               global $wgHooks;
-
                parent::setUp();
 
                // Anon user
@@ -30,26 +27,16 @@ class TextContentTest extends MediaWikiLangTestCase {
                                CONTENT_MODEL_JAVASCRIPT,
                        ),
                        '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'] );
-               }
+               MWTidy::destroySingleton();
        }
 
-       public function teardown() {
-               global $wgHooks;
-
-               // restore hooks that force custom rendering
-               if ( $this->savedContentGetParserOutput !== null ) {
-                       $wgHooks['ContentGetParserOutput'] = $this->savedContentGetParserOutput;
-               }
-
-               parent::teardown();
+       protected function tearDown() {
+               MWTidy::destroySingleton();
+               parent::tearDown();
        }
 
        public function newContent( $text ) {
@@ -106,12 +93,12 @@ class TextContentTest extends MediaWikiLangTestCase {
        public static function dataPreSaveTransform() {
                return array(
                        array(
-                               #0: no signature resolution
+                               # 0: no signature resolution
                                'hello this is ~~~',
                                'hello this is ~~~',
                        ),
                        array(
-                               #1: rtrim
+                               # 1: rtrim
                                " Foo \n ",
                                ' Foo',
                        ),
@@ -434,7 +421,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                        $update = $updates[$class];
 
                        foreach ( $fieldValues as $field => $value ) {
-                               $v = $update->$field; #if the field doesn't exist, just crash and burn
+                               $v = $update->$field; # if the field doesn't exist, just crash and burn
                                $this->assertEquals( $value, $v, "unexpected value for field $field in instance of $class" );
                        }
                }