From 63f42295c3cd5b793d0d18c51091690d8f1ce5bb Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 19 Sep 2012 20:07:56 +0200 Subject: [PATCH] Don't assume main namespace contains wikitext Change-Id: Ie5bb593f850ab97b2e63f064e3fc52bc17edfdd1 --- tests/phpunit/includes/ContentHandlerTest.php | 16 +- tests/phpunit/includes/CssContentTest.php | 3 +- .../includes/JavascriptContentTest.php | 2 +- .../phpunit/includes/RevisionStorageTest.php | 25 +- tests/phpunit/includes/RevisionTest.php | 21 +- tests/phpunit/includes/TitleMethodsTest.php | 36 +- tests/phpunit/includes/WikiPageTest.php | 335 ++++++++++-------- .../phpunit/includes/WikitextContentTest.php | 28 +- .../phpunit/includes/api/ApiEditPageTest.php | 2 +- tests/phpunit/includes/api/ApiWatchTest.php | 18 +- 10 files changed, 266 insertions(+), 220 deletions(-) diff --git a/tests/phpunit/includes/ContentHandlerTest.php b/tests/phpunit/includes/ContentHandlerTest.php index 633f72d340..4db4754b10 100644 --- a/tests/phpunit/includes/ContentHandlerTest.php +++ b/tests/phpunit/includes/ContentHandlerTest.php @@ -41,10 +41,11 @@ class ContentHandlerTest extends MediaWikiTestCase { } public function dataGetDefaultModelFor() { + //NOTE: assume that the Help namespace default to wikitext content return array( - array( 'Foo', CONTENT_MODEL_WIKITEXT ), - array( 'Foo.js', CONTENT_MODEL_WIKITEXT ), - array( 'Foo/bar.js', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo.js', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo/bar.js', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo.js', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo/bar.js', CONTENT_MODEL_JAVASCRIPT ), @@ -196,20 +197,21 @@ class ContentHandlerTest extends MediaWikiTestCase { #public static function makeContent( $text, Title $title, $modelId = null, $format = null ) public function dataMakeContent() { + //NOTE: assume the Help namespace defaults to wikitext content return array( - array( 'hallo', 'Test', null, null, CONTENT_MODEL_WIKITEXT, 'hallo', false ), + array( 'hallo', 'Help:Test', null, null, CONTENT_MODEL_WIKITEXT, 'hallo', false ), array( 'hallo', 'MediaWiki:Test.js', null, null, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ), array( serialize('hallo'), 'Dummy:Test', null, null, "testing", 'hallo', false ), - array( 'hallo', 'Test', null, CONTENT_FORMAT_WIKITEXT, CONTENT_MODEL_WIKITEXT, 'hallo', false ), + array( 'hallo', 'Help:Test', null, CONTENT_FORMAT_WIKITEXT, CONTENT_MODEL_WIKITEXT, 'hallo', false ), array( 'hallo', 'MediaWiki:Test.js', null, CONTENT_FORMAT_JAVASCRIPT, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ), array( serialize('hallo'), 'Dummy:Test', null, "testing", "testing", 'hallo', false ), - array( 'hallo', 'Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ), + array( 'hallo', 'Help:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ), array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ), array( serialize('hallo'), 'Dummy:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, serialize('hallo'), false ), - array( 'hallo', 'Test', CONTENT_MODEL_WIKITEXT, "testing", null, null, true ), + array( 'hallo', 'Help:Test', CONTENT_MODEL_WIKITEXT, "testing", null, null, true ), array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, "testing", null, null, true ), array( 'hallo', 'Dummy:Test', CONTENT_MODEL_JAVASCRIPT, "testing", null, null, true ), ); diff --git a/tests/phpunit/includes/CssContentTest.php b/tests/phpunit/includes/CssContentTest.php index 163ce48eab..ebbece21e6 100644 --- a/tests/phpunit/includes/CssContentTest.php +++ b/tests/phpunit/includes/CssContentTest.php @@ -15,7 +15,8 @@ class CssContentTest extends JavascriptContentTest { public function dataGetParserOutput() { return array( - array("MediaWiki:Test.css", "hello \n", "
\nhello <world>\n\n
\n"), + array("MediaWiki:Test.css", null, "hello \n", + "
\nhello <world>\n\n
\n"), // @todo: more...? ); } diff --git a/tests/phpunit/includes/JavascriptContentTest.php b/tests/phpunit/includes/JavascriptContentTest.php index f8a9bdfbd8..a3b75d1238 100644 --- a/tests/phpunit/includes/JavascriptContentTest.php +++ b/tests/phpunit/includes/JavascriptContentTest.php @@ -15,7 +15,7 @@ class JavascriptContentTest extends WikitextContentTest { public function dataGetParserOutput() { return array( - array("MediaWiki:Test.js", "hello \n", + array("MediaWiki:Test.js", null, "hello \n", "
\nhello <world>\n\n
\n"), // @todo: more...? ); diff --git a/tests/phpunit/includes/RevisionStorageTest.php b/tests/phpunit/includes/RevisionStorageTest.php index 4786e3d44f..81404c7217 100644 --- a/tests/phpunit/includes/RevisionStorageTest.php +++ b/tests/phpunit/includes/RevisionStorageTest.php @@ -51,7 +51,7 @@ class RevisionStorageTest extends MediaWikiTestCase { $wgContLang->resetNamespaces(); # reset namespace cache if ( !$this->the_page ) { - $this->the_page = $this->createPage( 'RevisionStorageTest_the_page', "just a dummy page" ); + $this->the_page = $this->createPage( 'RevisionStorageTest_the_page', "just a dummy page", CONTENT_MODEL_WIKITEXT ); } } @@ -153,7 +153,7 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testNewFromArchiveRow() { - $page = $this->createPage( 'RevisionStorageTest_testNewFromArchiveRow', 'Lorem Ipsum' ); + $page = $this->createPage( 'RevisionStorageTest_testNewFromArchiveRow', 'Lorem Ipsum', CONTENT_MODEL_WIKITEXT ); $orig = $page->getRevision(); $page->doDeleteArticle( 'test Revision::newFromArchiveRow' ); @@ -186,7 +186,7 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testFetchRevision() { - $page = $this->createPage( 'RevisionStorageTest_testFetchRevision', 'one' ); + $page = $this->createPage( 'RevisionStorageTest_testFetchRevision', 'one', CONTENT_MODEL_WIKITEXT ); $id1 = $page->getRevision()->getId(); $page->doEditContent( new WikitextContent( 'two' ), 'second rev' ); @@ -333,7 +333,7 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testIsCurrent() { - $page = $this->createPage( 'RevisionStorageTest_testIsCurrent', 'Lorem Ipsum' ); + $page = $this->createPage( 'RevisionStorageTest_testIsCurrent', 'Lorem Ipsum', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); # @todo: find out if this should be true @@ -342,7 +342,7 @@ class RevisionStorageTest extends MediaWikiTestCase { $rev1x = Revision::newFromId( $rev1->getId() ); $this->assertTrue( $rev1x->isCurrent() ); - $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle() ), 'second rev' ); + $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle(), CONTENT_MODEL_WIKITEXT ), 'second rev' ); $rev2 = $page->getRevision(); # @todo: find out if this should be true @@ -360,12 +360,12 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testGetPrevious() { - $page = $this->createPage( 'RevisionStorageTest_testGetPrevious', 'Lorem Ipsum testGetPrevious' ); + $page = $this->createPage( 'RevisionStorageTest_testGetPrevious', 'Lorem Ipsum testGetPrevious', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); $this->assertNull( $rev1->getPrevious() ); - $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle() ), + $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle(), CONTENT_MODEL_WIKITEXT ), 'second rev testGetPrevious' ); $rev2 = $page->getRevision(); @@ -378,12 +378,12 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testGetNext() { - $page = $this->createPage( 'RevisionStorageTest_testGetNext', 'Lorem Ipsum testGetNext' ); + $page = $this->createPage( 'RevisionStorageTest_testGetNext', 'Lorem Ipsum testGetNext', CONTENT_MODEL_WIKITEXT ); $rev1 = $page->getRevision(); $this->assertNull( $rev1->getNext() ); - $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle() ), + $page->doEditContent( ContentHandler::makeContent( 'Bla bla', $page->getTitle(), CONTENT_MODEL_WIKITEXT ), 'second rev testGetNext' ); $rev2 = $page->getRevision(); @@ -396,7 +396,7 @@ class RevisionStorageTest extends MediaWikiTestCase { */ public function testNewNullRevision() { - $page = $this->createPage( 'RevisionStorageTest_testNewNullRevision', 'some testing text' ); + $page = $this->createPage( 'RevisionStorageTest_testNewNullRevision', 'some testing text', CONTENT_MODEL_WIKITEXT ); $orig = $page->getRevision(); $dbw = wfGetDB( DB_MASTER ); @@ -454,6 +454,7 @@ class RevisionStorageTest extends MediaWikiTestCase { 'timestamp' => '20120101000000', 'user' => $userA->getId(), 'text' => 'zero', + 'content_model' => CONTENT_MODEL_WIKITEXT, 'summary' => 'edit zero' ) ); $revisions[0]->insertOn( $dbw ); @@ -465,6 +466,7 @@ class RevisionStorageTest extends MediaWikiTestCase { 'timestamp' => '20120101000100', 'user' => $userA->getId(), 'text' => 'one', + 'content_model' => CONTENT_MODEL_WIKITEXT, 'summary' => 'edit one' ) ); $revisions[1]->insertOn( $dbw ); @@ -476,6 +478,7 @@ class RevisionStorageTest extends MediaWikiTestCase { 'timestamp' => '20120101000200', 'user' => $userB->getId(), 'text' => 'two', + 'content_model' => CONTENT_MODEL_WIKITEXT, 'summary' => 'edit two' ) ); $revisions[2]->insertOn( $dbw ); @@ -487,6 +490,7 @@ class RevisionStorageTest extends MediaWikiTestCase { 'timestamp' => '20120101000300', 'user' => $userA->getId(), 'text' => 'three', + 'content_model' => CONTENT_MODEL_WIKITEXT, 'summary' => 'edit three' ) ); $revisions[3]->insertOn( $dbw ); @@ -498,6 +502,7 @@ class RevisionStorageTest extends MediaWikiTestCase { 'timestamp' => '20120101000200', 'user' => $userA->getId(), 'text' => 'zero', + 'content_model' => CONTENT_MODEL_WIKITEXT, 'summary' => 'edit four' ) ); $revisions[4]->insertOn( $dbw ); diff --git a/tests/phpunit/includes/RevisionTest.php b/tests/phpunit/includes/RevisionTest.php index 377891490b..b819728ad6 100644 --- a/tests/phpunit/includes/RevisionTest.php +++ b/tests/phpunit/includes/RevisionTest.php @@ -184,8 +184,9 @@ class RevisionTest extends MediaWikiTestCase { } function dataGetContentModel() { + //NOTE: we expect the help namespace to always contain wikitext return array( - array( 'hello world', 'Hello', null, null, CONTENT_MODEL_WIKITEXT ), + array( 'hello world', 'Help:Hello', null, null, CONTENT_MODEL_WIKITEXT ), array( 'hello world', 'User:hello/there.css', null, null, CONTENT_MODEL_CSS ), array( serialize('hello world'), 'Dummy:Hello', null, null, "testing" ), ); @@ -202,9 +203,10 @@ class RevisionTest extends MediaWikiTestCase { } function dataGetContentFormat() { + //NOTE: we expect the help namespace to always contain wikitext return array( - array( 'hello world', 'Hello', null, null, CONTENT_FORMAT_WIKITEXT ), - array( 'hello world', 'Hello', CONTENT_MODEL_CSS, null, CONTENT_FORMAT_CSS ), + array( 'hello world', 'Help:Hello', null, null, CONTENT_FORMAT_WIKITEXT ), + array( 'hello world', 'Help:Hello', CONTENT_MODEL_CSS, null, CONTENT_FORMAT_CSS ), array( 'hello world', 'User:hello/there.css', null, null, CONTENT_FORMAT_CSS ), array( serialize('hello world'), 'Dummy:Hello', null, null, "testing" ), ); @@ -221,8 +223,9 @@ class RevisionTest extends MediaWikiTestCase { } function dataGetContentHandler() { + //NOTE: we expect the help namespace to always contain wikitext return array( - array( 'hello world', 'Hello', null, null, 'WikitextContentHandler' ), + array( 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ), array( 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ), array( serialize('hello world'), 'Dummy:Hello', null, null, 'DummyContentHandlerForTesting' ), ); @@ -239,8 +242,9 @@ class RevisionTest extends MediaWikiTestCase { } function dataGetContent() { + //NOTE: we expect the help namespace to always contain wikitext return array( - array( 'hello world', 'Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ), + array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ), array( serialize('hello world'), 'Hello', "testing", null, Revision::FOR_PUBLIC, serialize('hello world') ), array( serialize('hello world'), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, serialize('hello world') ), ); @@ -258,8 +262,9 @@ class RevisionTest extends MediaWikiTestCase { } function dataGetText() { + //NOTE: we expect the help namespace to always contain wikitext return array( - array( 'hello world', 'Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ), + array( 'hello world', 'Help:Hello', null, null, Revision::FOR_PUBLIC, 'hello world' ), array( serialize('hello world'), 'Hello', "testing", null, Revision::FOR_PUBLIC, null ), array( serialize('hello world'), 'Dummy:Hello', null, null, Revision::FOR_PUBLIC, null ), ); @@ -292,7 +297,7 @@ class RevisionTest extends MediaWikiTestCase { public function dataGetSize( ) { return array( - array( "hello world.", null, 12 ), + array( "hello world.", CONTENT_MODEL_WIKITEXT, 12 ), array( serialize( "hello world." ), "testing", 12 ), ); } @@ -310,7 +315,7 @@ class RevisionTest extends MediaWikiTestCase { public function dataGetSha1( ) { return array( - array( "hello world.", null, Revision::base36Sha1( "hello world." ) ), + array( "hello world.", CONTENT_MODEL_WIKITEXT, Revision::base36Sha1( "hello world." ) ), array( serialize( "hello world." ), "testing", Revision::base36Sha1( serialize( "hello world." ) ) ), ); } diff --git a/tests/phpunit/includes/TitleMethodsTest.php b/tests/phpunit/includes/TitleMethodsTest.php index de8f18fb5b..7291ae4ade 100644 --- a/tests/phpunit/includes/TitleMethodsTest.php +++ b/tests/phpunit/includes/TitleMethodsTest.php @@ -2,6 +2,10 @@ /** * @group ContentHandler + * + * @note: We don't make assumptions about the main namespace. + * But we do expect the Help namespace to contain Wikitext. + * */ class TitleMethodsTest extends MediaWikiTestCase { @@ -104,9 +108,9 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataGetContentModel() { return array( - array( 'Foo', CONTENT_MODEL_WIKITEXT ), - array( 'Foo.js', CONTENT_MODEL_WIKITEXT ), - array( 'Foo/bar.js', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo.js', CONTENT_MODEL_WIKITEXT ), + array( 'Help:Foo/bar.js', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo.js', CONTENT_MODEL_WIKITEXT ), array( 'User:Foo/bar.js', CONTENT_MODEL_JAVASCRIPT ), @@ -145,9 +149,9 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataIsCssOrJsPage() { return array( - array( 'Foo', false ), - array( 'Foo.js', false ), - array( 'Foo/bar.js', false ), + array( 'Help:Foo', false ), + array( 'Help:Foo.js', false ), + array( 'Help:Foo/bar.js', false ), array( 'User:Foo', false ), array( 'User:Foo.js', false ), array( 'User:Foo/bar.js', false ), @@ -176,9 +180,9 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataIsCssJsSubpage() { return array( - array( 'Foo', false ), - array( 'Foo.js', false ), - array( 'Foo/bar.js', false ), + array( 'Help:Foo', false ), + array( 'Help:Foo.js', false ), + array( 'Help:Foo/bar.js', false ), array( 'User:Foo', false ), array( 'User:Foo.js', false ), array( 'User:Foo/bar.js', true ), @@ -204,8 +208,8 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataIsCssSubpage() { return array( - array( 'Foo', false ), - array( 'Foo.css', false ), + array( 'Help:Foo', false ), + array( 'Help:Foo.css', false ), array( 'User:Foo', false ), array( 'User:Foo.js', false ), array( 'User:Foo.css', false ), @@ -224,8 +228,8 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataIsJsSubpage() { return array( - array( 'Foo', false ), - array( 'Foo.css', false ), + array( 'Help:Foo', false ), + array( 'Help:Foo.css', false ), array( 'User:Foo', false ), array( 'User:Foo.js', false ), array( 'User:Foo.css', false ), @@ -244,9 +248,9 @@ class TitleMethodsTest extends MediaWikiTestCase { public function dataIsWikitextPage() { return array( - array( 'Foo', true ), - array( 'Foo.js', true ), - array( 'Foo/bar.js', true ), + array( 'Help:Foo', true ), + array( 'Help:Foo.js', true ), + array( 'Help:Foo/bar.js', true ), array( 'User:Foo', true ), array( 'User:Foo.js', true ), array( 'User:Foo/bar.js', false ), diff --git a/tests/phpunit/includes/WikiPageTest.php b/tests/phpunit/includes/WikiPageTest.php index 49b27af671..23a4a01124 100644 --- a/tests/phpunit/includes/WikiPageTest.php +++ b/tests/phpunit/includes/WikiPageTest.php @@ -13,23 +13,23 @@ class WikiPageTest extends MediaWikiLangTestCase { parent::__construct( $name, $data, $dataName ); $this->tablesUsed = array_merge ( $this->tablesUsed, - array( 'page', - 'revision', - 'text', - - 'recentchanges', - 'logging', - - 'page_props', - 'pagelinks', - 'categorylinks', - 'langlinks', - 'externallinks', - 'imagelinks', - 'templatelinks', - 'iwlinks' ) ); - } - + array( 'page', + 'revision', + 'text', + + 'recentchanges', + 'logging', + + 'page_props', + 'pagelinks', + 'categorylinks', + 'langlinks', + 'externallinks', + 'imagelinks', + 'templatelinks', + 'iwlinks' ) ); + } + public function setUp() { parent::setUp(); $this->pages_to_delete = array(); @@ -54,10 +54,13 @@ class WikiPageTest extends MediaWikiLangTestCase { /** * @param Title $title + * @param String $model * @return WikiPage */ - protected function newPage( $title ) { - if ( is_string( $title ) ) $title = Title::newFromText( $title ); + protected function newPage( $title, $model = null ) { + if ( is_string( $title ) ) { + $title = Title::newFromText( $title ); + } $p = new WikiPage( $title ); @@ -75,13 +78,12 @@ class WikiPageTest extends MediaWikiLangTestCase { * @return WikiPage */ protected function createPage( $page, $text, $model = null ) { - if ( is_string( $page ) ) $page = Title::newFromText( $page ); + if ( is_string( $page ) ) { + $page = Title::newFromText( $page ); + } if ( $page instanceof Title ) { - $title = $page; - $page = $this->newPage( $page ); - } else { - $title = null; + $page = $this->newPage( $page, $model ); } $content = ContentHandler::makeContent( $text, $page->getTitle(), $model ); @@ -96,8 +98,8 @@ class WikiPageTest extends MediaWikiLangTestCase { $page = $this->newPage( $title ); $content = ContentHandler::makeContent( "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam " - . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.", - $title ); + . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.", + $title, CONTENT_MODEL_WIKITEXT ); $page->doEditContent( $content, "[[testing]] 1" ); @@ -124,8 +126,8 @@ class WikiPageTest extends MediaWikiLangTestCase { # ------------------------ $content = ContentHandler::makeContent( "At vero eos et accusam et justo duo [[dolores]] et ea rebum. " - . "Stet clita kasd [[gubergren]], no sea takimata sanctus est.", - $title ); + . "Stet clita kasd [[gubergren]], no sea takimata sanctus est.", + $title, CONTENT_MODEL_WIKITEXT ); $page->doEditContent( $content, "testing 2" ); @@ -143,18 +145,19 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' ); } - + public function testDoEdit() { $this->hideDeprecated( "WikiPage::doEdit" ); $this->hideDeprecated( "WikiPage::getText" ); $this->hideDeprecated( "Revision::getText" ); - $title = Title::newFromText( "WikiPageTest_testDoEdit" ); + //NOTE: assume help namespace will default to wikitext + $title = Title::newFromText( "Help:WikiPageTest_testDoEdit" ); $page = $this->newPage( $title ); $text = "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam " - . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat."; + . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat."; $page->doEdit( $text, "[[testing]] 1" ); @@ -181,7 +184,7 @@ class WikiPageTest extends MediaWikiLangTestCase { # ------------------------ $text = "At vero eos et accusam et justo duo [[dolores]] et ea rebum. " - . "Stet clita kasd [[gubergren]], no sea takimata sanctus est."; + . "Stet clita kasd [[gubergren]], no sea takimata sanctus est."; $page->doEdit( $text, "testing 2" ); @@ -205,7 +208,8 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->hideDeprecated( "WikiPage::doQuickEdit" ); - $page = $this->createPage( "WikiPageTest_testDoQuickEdit", "original text" ); + //NOTE: assume help namespace will default to wikitext + $page = $this->createPage( "Help:WikiPageTest_testDoQuickEdit", "original text" ); $text = "quick text"; $page->doQuickEdit( $text, $wgUser, "testing q" ); @@ -218,18 +222,18 @@ class WikiPageTest extends MediaWikiLangTestCase { public function testDoQuickEditContent() { global $wgUser; - $page = $this->createPage( "WikiPageTest_testDoQuickEditContent", "original text" ); + $page = $this->createPage( "WikiPageTest_testDoQuickEditContent", "original text", CONTENT_MODEL_WIKITEXT ); - $content = ContentHandler::makeContent( "quick text", $page->getTitle() ); + $content = ContentHandler::makeContent( "quick text", $page->getTitle(), CONTENT_MODEL_WIKITEXT ); $page->doQuickEditContent( $content, $wgUser, "testing q" ); # --------------------- $page = new WikiPage( $page->getTitle() ); $this->assertTrue( $content->equals( $page->getContent() ) ); } - + public function testDoDeleteArticle() { - $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo" ); + $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT ); $id = $page->getId(); $page->doDeleteArticle( "testing deletion" ); @@ -253,7 +257,7 @@ class WikiPageTest extends MediaWikiLangTestCase { } public function testDoDeleteUpdates() { - $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo" ); + $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT ); $id = $page->getId(); $page->doDeleteUpdates( $id ); @@ -274,7 +278,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertNull( $rev ); # ----------------- - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $rev = $page->getRevision(); @@ -289,7 +293,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertNull( $content ); # ----------------- - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $content = $page->getContent(); $this->assertEquals( "some text", $content->getNativeData() ); @@ -304,7 +308,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertFalse( $text ); # ----------------- - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $text = $page->getText(); $this->assertEquals( "some text", $text ); @@ -319,7 +323,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertFalse( $text ); # ----------------- - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $text = $page->getRawText(); $this->assertEquals( "some text", $text ); @@ -356,7 +360,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertFalse( $page->exists() ); # ----------------- - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $this->assertTrue( $page->exists() ); $page = new WikiPage( $page->getTitle() ); @@ -388,7 +392,7 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertEquals( $viewable, $page->hasViewableContent() ); if ( $create ) { - $this->createPage( $page, "some text" ); + $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT ); $this->assertTrue( $page->hasViewableContent() ); $page = new WikiPage( $page->getTitle() ); @@ -398,21 +402,21 @@ class WikiPageTest extends MediaWikiLangTestCase { public function dataGetRedirectTarget() { return array( - array( 'WikiPageTest_testGetRedirectTarget_1', "hello world", null ), - array( 'WikiPageTest_testGetRedirectTarget_2', "#REDIRECT [[hello world]]", "Hello world" ), + array( 'WikiPageTest_testGetRedirectTarget_1', CONTENT_MODEL_WIKITEXT, "hello world", null ), + array( 'WikiPageTest_testGetRedirectTarget_2', CONTENT_MODEL_WIKITEXT, "#REDIRECT [[hello world]]", "Hello world" ), ); } /** * @dataProvider dataGetRedirectTarget */ - public function testGetRedirectTarget( $title, $text, $target ) { - $page = $this->createPage( $title, $text ); + public function testGetRedirectTarget( $title, $model, $text, $target ) { + $page = $this->createPage( $title, $text, $model ); # sanity check, because this test seems to fail for no reason for some people. $c = $page->getContent(); $this->assertEquals( 'WikitextContent', get_class( $c ) ); - + # now, test the actual redirect $t = $page->getRedirectTarget(); $this->assertEquals( $target, is_null( $t ) ? null : $t->getPrefixedText() ); @@ -421,8 +425,8 @@ class WikiPageTest extends MediaWikiLangTestCase { /** * @dataProvider dataGetRedirectTarget */ - public function testIsRedirect( $title, $text, $target ) { - $page = $this->createPage( $title, $text ); + public function testIsRedirect( $title, $model, $text, $target ) { + $page = $this->createPage( $title, $text, $model ); $this->assertEquals( !is_null( $target ), $page->isRedirect() ); } @@ -431,89 +435,104 @@ class WikiPageTest extends MediaWikiLangTestCase { // any array( 'WikiPageTest_testIsCountable', - '', - 'any', - true + CONTENT_MODEL_WIKITEXT, + '', + 'any', + true ), array( 'WikiPageTest_testIsCountable', - 'Foo', - 'any', - true + CONTENT_MODEL_WIKITEXT, + 'Foo', + 'any', + true ), // comma array( 'WikiPageTest_testIsCountable', - 'Foo', - 'comma', - false + CONTENT_MODEL_WIKITEXT, + 'Foo', + 'comma', + false ), array( 'WikiPageTest_testIsCountable', - 'Foo, bar', - 'comma', - true + CONTENT_MODEL_WIKITEXT, + 'Foo, bar', + 'comma', + true ), // link array( 'WikiPageTest_testIsCountable', - 'Foo', - 'link', - false + CONTENT_MODEL_WIKITEXT, + 'Foo', + 'link', + false ), array( 'WikiPageTest_testIsCountable', - 'Foo [[bar]]', - 'link', - true + CONTENT_MODEL_WIKITEXT, + 'Foo [[bar]]', + 'link', + true ), // redirects array( 'WikiPageTest_testIsCountable', - '#REDIRECT [[bar]]', - 'any', - false + CONTENT_MODEL_WIKITEXT, + '#REDIRECT [[bar]]', + 'any', + false ), array( 'WikiPageTest_testIsCountable', - '#REDIRECT [[bar]]', - 'comma', - false + CONTENT_MODEL_WIKITEXT, + '#REDIRECT [[bar]]', + 'comma', + false ), array( 'WikiPageTest_testIsCountable', - '#REDIRECT [[bar]]', - 'link', - false + CONTENT_MODEL_WIKITEXT, + '#REDIRECT [[bar]]', + 'link', + false ), // not a content namespace array( 'Talk:WikiPageTest_testIsCountable', - 'Foo', - 'any', - false + CONTENT_MODEL_WIKITEXT, + 'Foo', + 'any', + false ), array( 'Talk:WikiPageTest_testIsCountable', - 'Foo, bar', - 'comma', - false + CONTENT_MODEL_WIKITEXT, + 'Foo, bar', + 'comma', + false ), array( 'Talk:WikiPageTest_testIsCountable', - 'Foo [[bar]]', - 'link', - false + CONTENT_MODEL_WIKITEXT, + 'Foo [[bar]]', + 'link', + false ), // not a content namespace, different model array( 'MediaWiki:WikiPageTest_testIsCountable.js', - 'Foo', - 'any', - false + null, + 'Foo', + 'any', + false ), array( 'MediaWiki:WikiPageTest_testIsCountable.js', - 'Foo, bar', - 'comma', - false + null, + 'Foo, bar', + 'comma', + false ), array( 'MediaWiki:WikiPageTest_testIsCountable.js', - 'Foo [[bar]]', - 'link', - false + null, + 'Foo [[bar]]', + 'link', + false ), ); } @@ -522,13 +541,13 @@ class WikiPageTest extends MediaWikiLangTestCase { /** * @dataProvider dataIsCountable */ - public function testIsCountable( $title, $text, $mode, $expected ) { + public function testIsCountable( $title, $model, $text, $mode, $expected ) { global $wgArticleCountMethod; $oldArticleCountMethod = $wgArticleCountMethod; $wgArticleCountMethod = $mode; - $page = $this->createPage( $title, $text ); + $page = $this->createPage( $title, $text, $model ); $hasLinks = wfGetDB( DB_SLAVE )->selectField( 'pagelinks', 1, array( 'pl_from' => $page->getId() ), __METHOD__ ); @@ -540,15 +559,15 @@ class WikiPageTest extends MediaWikiLangTestCase { $wgArticleCountMethod = $oldArticleCountMethod; $this->assertEquals( $expected, $v, "isCountable( null ) returned unexpected value " . var_export( $v, true ) - . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); + . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); $this->assertEquals( $expected, $w, "isCountable( \$editInfo ) returned unexpected value " . var_export( $v, true ) - . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); + . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" ); } public function dataGetParserOutput() { return array( - array("hello ''world''\n", "

hello world

"), + array( CONTENT_MODEL_WIKITEXT, "hello ''world''\n", "

hello world

"), // @todo: more...? ); } @@ -556,8 +575,8 @@ class WikiPageTest extends MediaWikiLangTestCase { /** * @dataProvider dataGetParserOutput */ - public function testGetParserOutput( $text, $expectedHtml ) { - $page = $this->createPage( 'WikiPageTest_testGetParserOutput', $text ); + public function testGetParserOutput( $model, $text, $expectedHtml ) { + $page = $this->createPage( 'WikiPageTest_testGetParserOutput', $text, $model ); $opt = new ParserOptions(); $po = $page->getParserOutput( $opt ); @@ -586,43 +605,49 @@ more stuff public function dataReplaceSection() { + //NOTE: assume the Help namespace to contain wikitext return array( - array( 'WikiPageTest_testReplaceSection', - WikiPageTest::$sections, - "0", - "No more", - null, - trim( preg_replace( '/^Intro/sm', 'No more', WikiPageTest::$sections ) ) - ), - array( 'WikiPageTest_testReplaceSection', - WikiPageTest::$sections, - "", - "No more", - null, - "No more" - ), - array( 'WikiPageTest_testReplaceSection', - WikiPageTest::$sections, - "2", - "== TEST ==\nmore fun", - null, - trim( preg_replace( '/^== test ==.*== foo ==/sm', - "== TEST ==\nmore fun\n\n== foo ==", - WikiPageTest::$sections ) ) - ), - array( 'WikiPageTest_testReplaceSection', - WikiPageTest::$sections, - "8", - "No more", - null, - trim( WikiPageTest::$sections ) - ), - array( 'WikiPageTest_testReplaceSection', - WikiPageTest::$sections, - "new", - "No more", - "New", - trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more" + array( 'Help:WikiPageTest_testReplaceSection', + CONTENT_MODEL_WIKITEXT, + WikiPageTest::$sections, + "0", + "No more", + null, + trim( preg_replace( '/^Intro/sm', 'No more', WikiPageTest::$sections ) ) + ), + array( 'Help:WikiPageTest_testReplaceSection', + CONTENT_MODEL_WIKITEXT, + WikiPageTest::$sections, + "", + "No more", + null, + "No more" + ), + array( 'Help:WikiPageTest_testReplaceSection', + CONTENT_MODEL_WIKITEXT, + WikiPageTest::$sections, + "2", + "== TEST ==\nmore fun", + null, + trim( preg_replace( '/^== test ==.*== foo ==/sm', + "== TEST ==\nmore fun\n\n== foo ==", + WikiPageTest::$sections ) ) + ), + array( 'Help:WikiPageTest_testReplaceSection', + CONTENT_MODEL_WIKITEXT, + WikiPageTest::$sections, + "8", + "No more", + null, + trim( WikiPageTest::$sections ) + ), + array( 'Help:WikiPageTest_testReplaceSection', + CONTENT_MODEL_WIKITEXT, + WikiPageTest::$sections, + "new", + "No more", + "New", + trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more" ), ); } @@ -630,10 +655,10 @@ more stuff /** * @dataProvider dataReplaceSection */ - public function testReplaceSection( $title, $text, $section, $with, $sectionTitle, $expected ) { + public function testReplaceSection( $title, $model, $text, $section, $with, $sectionTitle, $expected ) { $this->hideDeprecated( "WikiPage::replaceSection" ); - $page = $this->createPage( $title, $text ); + $page = $this->createPage( $title, $text, $model ); $text = $page->replaceSection( $section, $with, $sectionTitle ); $text = trim( $text ); @@ -643,15 +668,15 @@ more stuff /** * @dataProvider dataReplaceSection */ - public function testReplaceSectionContent( $title, $text, $section, $with, $sectionTitle, $expected ) { - $page = $this->createPage( $title, $text ); + public function testReplaceSectionContent( $title, $model, $text, $section, $with, $sectionTitle, $expected ) { + $page = $this->createPage( $title, $text, $model ); $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() ); $c = $page->replaceSectionContent( $section, $content, $sectionTitle ); $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) ); } - + /* @todo FIXME: fix this! public function testGetUndoText() { global $wgDiff3; @@ -768,7 +793,7 @@ more stuff $text = "one"; $page = $this->newPage( "WikiPageTest_testDoRollback" ); - $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), + $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ), "section one", EDIT_NEW, false, $admin ); $rev1 = $page->getRevision(); @@ -776,7 +801,7 @@ more stuff $user1->setName( "127.0.1.11" ); $text .= "\n\ntwo"; $page = new WikiPage( $page->getTitle() ); - $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), + $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ), "adding section two", 0, false, $user1 ); # now, try the rollback @@ -886,10 +911,10 @@ more stuff array( array( array( "first edit: " - . "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam " - . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. " - . "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea " - . "takimata sanctus est Lorem ipsum dolor sit amet.'", null ), + . "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam " + . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. " + . "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea " + . "takimata sanctus est Lorem ipsum dolor sit amet.'", null ), ), '/first edit:.*\.\.\."/', false @@ -913,7 +938,8 @@ more stuff public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) { global $wgUser; - $page = $this->newPage( "WikiPageTest_testGetAutoDeleteReason" ); + //NOTE: assume Help namespace to contain wikitext + $page = $this->newPage( "Help:WikiPageTest_testGetAutoDeleteReason" ); $c = 1; @@ -945,10 +971,10 @@ more stuff public function dataPreSaveTransform() { return array( array( 'hello this is ~~~', - "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]", + "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]", ), array( 'hello \'\'this\'\' is ~~~', - 'hello \'\'this\'\' is ~~~', + 'hello \'\'this\'\' is ~~~', ), ); } @@ -961,7 +987,8 @@ more stuff $user = new User(); $user->setName("127.0.0.1"); - $page = $this->newPage( "WikiPageTest_testPreloadTransform" ); + //NOTE: assume Help namespace to contain wikitext + $page = $this->newPage( "Help:WikiPageTest_testPreloadTransform" ); $text = $page->preSaveTransform( $text, $user ); $this->assertEquals( $expected, $text ); diff --git a/tests/phpunit/includes/WikitextContentTest.php b/tests/phpunit/includes/WikitextContentTest.php index 7a7ba914b1..8d69cf7610 100644 --- a/tests/phpunit/includes/WikitextContentTest.php +++ b/tests/phpunit/includes/WikitextContentTest.php @@ -27,7 +27,7 @@ class WikitextContentTest extends MediaWikiTestCase { public function dataGetParserOutput() { return array( - array("WikitextContentTest_testGetParserOutput", "hello ''world''\n", "

hello world\n

"), + array("WikitextContentTest_testGetParserOutput", CONTENT_MODEL_WIKITEXT, "hello ''world''\n", "

hello world\n

"), // @todo: more...? ); } @@ -35,9 +35,9 @@ class WikitextContentTest extends MediaWikiTestCase { /** * @dataProvider dataGetParserOutput */ - public function testGetParserOutput( $title, $text, $expectedHtml ) { + public function testGetParserOutput( $title, $model, $text, $expectedHtml ) { $title = Title::newFromText( $title ); - $content = ContentHandler::makeContent( $text, $title ); + $content = ContentHandler::makeContent( $text, $title, $model ); $po = $content->getParserOutput( $title ); @@ -47,11 +47,13 @@ class WikitextContentTest extends MediaWikiTestCase { public function dataGetSecondaryDataUpdates() { return array( - array("WikitextContentTest_testGetSecondaryDataUpdates_1", "hello ''world''\n", + array("WikitextContentTest_testGetSecondaryDataUpdates_1", + CONTENT_MODEL_WIKITEXT, "hello ''world''\n", array( 'LinksUpdate' => array( 'mRecursive' => true, 'mLinks' => array() ) ) ), - array("WikitextContentTest_testGetSecondaryDataUpdates_2", "hello [[world test 21344]]\n", + array("WikitextContentTest_testGetSecondaryDataUpdates_2", + CONTENT_MODEL_WIKITEXT, "hello [[world test 21344]]\n", array( 'LinksUpdate' => array( 'mRecursive' => true, 'mLinks' => array( array( 'World_test_21344' => 0 ) ) ) ) ), @@ -63,12 +65,11 @@ class WikitextContentTest extends MediaWikiTestCase { * @dataProvider dataGetSecondaryDataUpdates * @group Database */ - public function testGetSecondaryDataUpdates( $title, $text, $expectedStuff ) { + public function testGetSecondaryDataUpdates( $title, $model, $text, $expectedStuff ) { $title = Title::newFromText( $title ); $title->resetArticleID( 2342 ); //dummy id. fine as long as we don't try to execute the updates! - $handler = ContentHandler::getForModelID( $title->getContentModel() ); - $content = ContentHandler::makeContent( $text, $title ); + $content = ContentHandler::makeContent( $text, $title, $model ); $updates = $content->getSecondaryDataUpdates( $title ); @@ -509,10 +510,12 @@ just a test" public function dataGetDeletionUpdates() { return array( - array("WikitextContentTest_testGetSecondaryDataUpdates_1", "hello ''world''\n", + array("WikitextContentTest_testGetSecondaryDataUpdates_1", + CONTENT_MODEL_WIKITEXT, "hello ''world''\n", array( 'LinksDeletionUpdate' => array( ) ) ), - array("WikitextContentTest_testGetSecondaryDataUpdates_2", "hello [[world test 21344]]\n", + array("WikitextContentTest_testGetSecondaryDataUpdates_2", + CONTENT_MODEL_WIKITEXT, "hello [[world test 21344]]\n", array( 'LinksDeletionUpdate' => array( ) ) ), // @todo: more...? @@ -522,12 +525,11 @@ just a test" /** * @dataProvider dataGetDeletionUpdates */ - public function testDeletionUpdates( $title, $text, $expectedStuff ) { + public function testDeletionUpdates( $title, $model, $text, $expectedStuff ) { $title = Title::newFromText( $title ); $title->resetArticleID( 2342 ); //dummy id. fine as long as we don't try to execute the updates! - $handler = ContentHandler::getForModelID( $title->getContentModel() ); - $content = ContentHandler::makeContent( $text, $title ); + $content = ContentHandler::makeContent( $text, $title, $model ); $updates = $content->getDeletionUpdates( WikiPage::factory( $title ) ); diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index f02c6d7e60..3a60c6aa30 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -43,7 +43,7 @@ class ApiEditPageTest extends ApiTestCase { } function testEdit( ) { - $name = 'ApiEditPageTest_testEdit'; + $name = 'Help:ApiEditPageTest_testEdit'; // assume Help namespace to default to wikitext // -- test new page -------------------------------------------- $apiResult = $this->doApiRequestWithToken( array( diff --git a/tests/phpunit/includes/api/ApiWatchTest.php b/tests/phpunit/includes/api/ApiWatchTest.php index d2e98152d1..65c742f6ad 100644 --- a/tests/phpunit/includes/api/ApiWatchTest.php +++ b/tests/phpunit/includes/api/ApiWatchTest.php @@ -29,7 +29,7 @@ class ApiWatchTest extends ApiTestCase { $data = $this->doApiRequest( array( 'action' => 'edit', - 'title' => 'UTPage', + 'title' => 'Help:UTPage', // Help namespace is hopefully wikitext 'text' => 'new text', 'token' => $pageinfo['edittoken'], 'watchlist' => 'watch' ) ); @@ -81,7 +81,7 @@ class ApiWatchTest extends ApiTestCase { $data = $this->doApiRequest( array( 'action' => 'protect', 'token' => $pageinfo['protecttoken'], - 'title' => 'UTPage', + 'title' => 'Help:UTPage', 'protections' => 'edit=sysop', 'watchlist' => 'unwatch' ) ); @@ -97,14 +97,14 @@ class ApiWatchTest extends ApiTestCase { $pageinfo = $this->getTokens(); - if ( !Title::newFromText( 'UTPage' )->exists() ) { - $this->markTestSkipped( "The article [[UTPage]] does not exist" ); //TODO: just create it? + if ( !Title::newFromText( 'Help:UTPage' )->exists() ) { + $this->markTestSkipped( "The article [[Help:UTPage]] does not exist" ); //TODO: just create it? } $data = $this->doApiRequest( array( 'action' => 'query', 'prop' => 'revisions', - 'titles' => 'UTPage', + 'titles' => 'Help:UTPage', 'rvtoken' => 'rollback' ) ); $this->assertArrayHasKey( 'query', $data[0] ); @@ -113,7 +113,7 @@ class ApiWatchTest extends ApiTestCase { $key = array_pop( $keys ); if ( isset( $data[0]['query']['pages'][$key]['missing'] ) ) { - $this->markTestSkipped( "Target page (UTPage) doesn't exist" ); + $this->markTestSkipped( "Target page (Help:UTPage) doesn't exist" ); } $this->assertArrayHasKey( 'pageid', $data[0]['query']['pages'][$key] ); @@ -139,7 +139,7 @@ class ApiWatchTest extends ApiTestCase { try { $data = $this->doApiRequest( array( 'action' => 'rollback', - 'title' => 'UTPage', + 'title' => 'Help:UTPage', 'user' => $revinfo['user'], 'token' => $pageinfo['rollbacktoken'], 'watchlist' => 'watch' ) ); @@ -148,7 +148,7 @@ class ApiWatchTest extends ApiTestCase { $this->assertArrayHasKey( 'title', $data[0]['rollback'] ); } catch( UsageException $ue ) { if( $ue->getCodeString() == 'onlyauthor' ) { - $this->markTestIncomplete( "Only one author to 'UTPage', cannot test rollback" ); + $this->markTestIncomplete( "Only one author to 'Help:UTPage', cannot test rollback" ); } else { $this->fail( "Received error '" . $ue->getCodeString() . "'" ); } @@ -163,7 +163,7 @@ class ApiWatchTest extends ApiTestCase { $data = $this->doApiRequest( array( 'action' => 'delete', 'token' => $pageinfo['deletetoken'], - 'title' => 'UTPage' ) ); + 'title' => 'Help:UTPage' ) ); $this->assertArrayHasKey( 'delete', $data[0] ); $this->assertArrayHasKey( 'title', $data[0]['delete'] ); -- 2.20.1