X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fcontent%2FTextContentTest.php;h=d69cfd1a86b0d1e79dda0e8da6da0c2a36d8c307;hb=b7625d63a6f1f8867c911dbd6e93eebdaca3312f;hp=b01a7db04a0a1670ea2d362984f2e5f6be7d27c6;hpb=7bf08b18758e314e725f9bf3855164595d257eb2;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/content/TextContentTest.php b/tests/phpunit/includes/content/TextContentTest.php index b01a7db04a..d69cfd1a86 100644 --- a/tests/phpunit/includes/content/TextContentTest.php +++ b/tests/phpunit/includes/content/TextContentTest.php @@ -13,6 +13,10 @@ class TextContentTest extends MediaWikiLangTestCase { protected function setUp() { parent::setUp(); + // trigger purging of all page related tables + $this->tablesUsed[] = 'page'; + $this->tablesUsed[] = 'revision'; + // Anon user $user = new User(); $user->setName( '127.0.0.1' ); @@ -352,11 +356,11 @@ class TextContentTest extends MediaWikiLangTestCase { public static function dataGetDeletionUpdates() { return [ - [ "TextContentTest_testGetSecondaryDataUpdates_1", + [ CONTENT_MODEL_TEXT, "hello ''world''\n", [] ], - [ "TextContentTest_testGetSecondaryDataUpdates_2", + [ CONTENT_MODEL_TEXT, "hello [[world test 21344]]\n", [] ], @@ -368,13 +372,11 @@ class TextContentTest extends MediaWikiLangTestCase { * @dataProvider dataGetDeletionUpdates * @covers TextContent::getDeletionUpdates */ - public function testDeletionUpdates( $title, $model, $text, $expectedStuff ) { - $ns = $this->getDefaultWikitextNS(); - $title = Title::newFromText( $title, $ns ); + public function testDeletionUpdates( $model, $text, $expectedStuff ) { + $page = $this->getNonexistingTestPage( get_class( $this ) . '-' . $this->getName() ); + $title = $page->getTitle(); $content = ContentHandler::makeContent( $text, $title, $model ); - - $page = WikiPage::factory( $title ); $page->doEditContent( $content, '' ); $updates = $content->getDeletionUpdates( $page ); @@ -385,11 +387,6 @@ class TextContentTest extends MediaWikiLangTestCase { $updates[$class] = $update; } - if ( !$expectedStuff ) { - $this->assertTrue( true ); // make phpunit happy - return; - } - foreach ( $expectedStuff as $class => $fieldValues ) { $this->assertArrayHasKey( $class, $updates, "missing an update of type $class" ); @@ -401,7 +398,8 @@ class TextContentTest extends MediaWikiLangTestCase { } } - $page->doDeleteArticle( '' ); + // make phpunit happy even if $expectedStuff was empty + $this->assertTrue( true ); } public static function provideConvert() {