Clear the title cache in MutableRevisionRecordTest
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 25 Oct 2018 04:31:58 +0000 (21:31 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 25 Oct 2018 21:16:27 +0000 (21:16 +0000)
Also do so in various other test classes.

Follows-up 170c49d61cb8. Fixes Travis CI regression:

> 1) MediaWiki\Tests\Revision\MutableRevisionRecordTest::testSetGetPageId
> Failed asserting that 2 is identical to 0.
> tests/phpunit/includes/Revision/MutableRevisionRecordTest.php:129

Change-Id: I41c8bda8e620ebe7608a393d81f3b0f13af68ba7

tests/phpunit/includes/Revision/MutableRevisionRecordTest.php
tests/phpunit/includes/TitleMethodsTest.php
tests/phpunit/includes/linker/LinkRendererTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
tests/phpunit/includes/search/SearchNearMatcherTest.php

index 060099e..dbe4d4e 100644 (file)
@@ -25,6 +25,11 @@ class MutableRevisionRecordTest extends MediaWikiTestCase {
 
        use RevisionRecordTests;
 
+       function setUp() {
+               Title::clearCaches();
+               parent::setUp();
+       }
+
        /**
         * @param array $rowOverrides
         *
index 715d469..44d440f 100644 (file)
@@ -352,4 +352,9 @@ class TitleMethodsTest extends MediaWikiLangTestCase {
                $this->assertNotSame( $title1, $title2, 'title cache should be empty' );
                $this->assertEquals( 0, $linkCache->getGoodLinkID( 'Foo' ), 'link cache should be empty' );
        }
+
+       function tearDown() {
+               Title::clearCaches();
+               parent::tearDown();
+       }
 }
index 8a05641..d550dcb 100644 (file)
@@ -191,4 +191,8 @@ class LinkRendererTest extends MediaWikiLangTestCase {
                );
        }
 
+       function tearDown() {
+               Title::clearCaches();
+               parent::tearDown();
+       }
 }
index a1ad8f9..ad8fa78 100644 (file)
@@ -442,6 +442,11 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
                        'Redirect resolved by getContent'
                );
        }
+
+       function tearDown() {
+               Title::clearCaches();
+               parent::tearDown();
+       }
 }
 
 class TestResourceLoaderWikiModule extends ResourceLoaderWikiModule {
index 132011a..9ccae8c 100644 (file)
@@ -27,4 +27,9 @@ class SearchNearMatcherTest extends \PHPUnit\Framework\TestCase {
                $title = $matcher->getNearMatch( $searchterm );
                $this->assertEquals( $expected, $title === null ? null : (string)$title );
        }
+
+       function tearDown() {
+               Title::clearCaches();
+               parent::tearDown();
+       }
 }