aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/content/TextContentTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/content/TextContentTest.php')
-rw-r--r--tests/phpunit/includes/content/TextContentTest.php24
1 files changed, 11 insertions, 13 deletions
diff --git a/tests/phpunit/includes/content/TextContentTest.php b/tests/phpunit/includes/content/TextContentTest.php
index b01a7db04a0a..d69cfd1a86b0 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() {