X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FEditPageTest.php;h=6537364994281b614cf786090a1d8b059ce85d8c;hb=0c75fef54c7dd045c2faff8dbb8b4e6e233d1a2d;hp=3c653b4a7aeb2da0a3c443736a49c2d94b24de7b;hpb=27f8aa732e55f0655255152fa22655fa07424c2d;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php index 3c653b4a7a..6537364994 100644 --- a/tests/phpunit/includes/EditPageTest.php +++ b/tests/phpunit/includes/EditPageTest.php @@ -82,7 +82,7 @@ class EditPageTest extends MediaWikiLangTestCase { * * wpMinorEdit: mark as minor edit * * wpWatchthis: whether to watch the page * @param int|null $expectedCode The expected result code (EditPage::AS_XXX constants). - * Set to null to skip the check. Defaults to EditPage::AS_OK. + * Set to null to skip the check. * @param string|null $expectedText The text expected to be on the page after the edit. * Set to null to skip the check. * @param string|null $message An optional message to show along with any error message. @@ -90,12 +90,13 @@ class EditPageTest extends MediaWikiLangTestCase { * @return WikiPage The page that was just edited, useful for getting the edit's rev_id, etc. */ protected function assertEdit( $title, $baseText, $user = null, array $edit, - $expectedCode = EditPage::AS_OK, $expectedText = null, $message = null + $expectedCode = null, $expectedText = null, $message = null ) { if ( is_string( $title ) ) { $ns = $this->getDefaultWikitextNS(); $title = Title::newFromText( $title, $ns ); } + $this->assertNotNull( $title ); if ( is_string( $user ) ) { $user = User::newFromName( $user ); @@ -141,7 +142,9 @@ class EditPageTest extends MediaWikiLangTestCase { $req = new FauxRequest( $edit, true ); // session ?? - $ep = new EditPage( new Article( $title ) ); + $article = new Article( $title ); + $article->getContext()->setTitle( $title ); + $ep = new EditPage( $article ); $ep->setContextTitle( $title ); $ep->importFormData( $req ); @@ -262,6 +265,19 @@ class EditPageTest extends MediaWikiLangTestCase { null, "expected MediaWiki: page not being created if text equals default message" ); + + $this->assertEdit( + 'EditPageTest_testCreatePage', + null, + null, + array( + 'wpTextbox1' => "", + 'wpIgnoreBlankArticle' => 1, + ), + EditPage::AS_SUCCESS_NEW_ARTICLE, + "", + "expected empty article being created" + )->doDeleteArticleReal( 'EditPageTest_testCreatePage' ); } public function testUpdatePage() {