From: Kunal Mehta Date: Fri, 27 Mar 2015 00:00:42 +0000 (-0700) Subject: Don't require database access for ContentHandlerTest X-Git-Tag: 1.31.0-rc.0~11976 X-Git-Url: http://git.cyclocoop.org/data/%24oldEdit?a=commitdiff_plain;h=95928eaefd856fd68bca3322a541ea9547fadb2c;p=lhc%2Fweb%2Fwiklou.git Don't require database access for ContentHandlerTest We can just mark all the titles as non-existent in the LinkCache Change-Id: Ifd6fdfd0f8318dac8af7f7509705cf30d44c8a4e --- diff --git a/tests/phpunit/includes/content/ContentHandlerTest.php b/tests/phpunit/includes/content/ContentHandlerTest.php index 1a90d6e201..988a59ee5a 100644 --- a/tests/phpunit/includes/content/ContentHandlerTest.php +++ b/tests/phpunit/includes/content/ContentHandlerTest.php @@ -2,11 +2,6 @@ /** * @group ContentHandler - * @group Database - * - * @note Declare that we are using the database, because otherwise we'll fail in - * the "databaseless" test run. This is because the LinkHolderArray used by the - * parser needs database access. */ class ContentHandlerTest extends MediaWikiTestCase { @@ -36,6 +31,8 @@ class ContentHandlerTest extends MediaWikiTestCase { // Reset namespace cache MWNamespace::getCanonicalNamespaces( true ); $wgContLang->resetNamespaces(); + // And LinkCache + LinkCache::destroySingleton(); } protected function tearDown() { @@ -44,6 +41,8 @@ class ContentHandlerTest extends MediaWikiTestCase { // Reset namespace cache MWNamespace::getCanonicalNamespaces( true ); $wgContLang->resetNamespaces(); + // And LinkCache + LinkCache::destroySingleton(); parent::tearDown(); } @@ -83,6 +82,7 @@ class ContentHandlerTest extends MediaWikiTestCase { */ public function testGetForTitle( $title, $expectedContentModel ) { $title = Title::newFromText( $title ); + LinkCache::singleton()->addBadLinkObj( $title ); $handler = ContentHandler::getForTitle( $title ); $this->assertEquals( $expectedContentModel, $handler->getModelID() ); } @@ -139,6 +139,7 @@ class ContentHandlerTest extends MediaWikiTestCase { public function testGetPageLanguage( $title, $expected ) { if ( is_string( $title ) ) { $title = Title::newFromText( $title ); + LinkCache::singleton()->addBadLinkObj( $title ); } $expected = wfGetLangObj( $expected ); @@ -292,7 +293,7 @@ class ContentHandlerTest extends MediaWikiTestCase { $expectedModelId, $expectedNativeData, $shouldFail ) { $title = Title::newFromText( $title ); - + LinkCache::singleton()->addBadLinkObj( $title ); try { $content = ContentHandler::makeContent( $data, $title, $modelId, $format );