summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/EditPageTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /tests/phpunit/includes/EditPageTest.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'tests/phpunit/includes/EditPageTest.php')
-rw-r--r--tests/phpunit/includes/EditPageTest.php93
1 files changed, 84 insertions, 9 deletions
diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php
index 00eba30a..87272a4c 100644
--- a/tests/phpunit/includes/EditPageTest.php
+++ b/tests/phpunit/includes/EditPageTest.php
@@ -9,12 +9,12 @@
* @group medium
* ^--- tell phpunit that these test cases may take longer than 2 seconds.
*/
-class EditPageTest extends MediaWikiTestCase {
+class EditPageTest extends MediaWikiLangTestCase {
/**
* @dataProvider provideExtractSectionTitle
*/
- function testExtractSectionTitle( $section, $title ) {
+ public function testExtractSectionTitle( $section, $title ) {
$extracted = EditPage::extractSectionTitle( $section );
$this->assertEquals( $title, $extracted );
}
@@ -173,15 +173,90 @@ class EditPageTest extends MediaWikiTestCase {
}
public function testCreatePage() {
- $text = "Hello World!";
- $edit = array(
- 'wpTextbox1' => $text,
- 'wpSummary' => 'just testing',
+ $this->assertEdit(
+ 'EditPageTest_testCreatePage',
+ null,
+ null,
+ array(
+ 'wpTextbox1' => "Hello World!",
+ ),
+ EditPage::AS_SUCCESS_NEW_ARTICLE,
+ "Hello World!",
+ "expected article being created"
+ )->doDeleteArticleReal( 'EditPageTest_testCreatePage' );
+
+ $this->assertEdit(
+ 'EditPageTest_testCreatePage',
+ null,
+ null,
+ array(
+ 'wpTextbox1' => "",
+ ),
+ EditPage::AS_BLANK_ARTICLE,
+ null,
+ "expected article not being created if empty"
+ );
+
+
+ $this->assertEdit(
+ 'MediaWiki:January',
+ null,
+ 'UTSysop',
+ array(
+ 'wpTextbox1' => "Not January",
+ ),
+ EditPage::AS_SUCCESS_NEW_ARTICLE,
+ "Not January",
+ "expected MediaWiki: page being created"
+ )->doDeleteArticleReal( 'EditPageTest_testCreatePage' );
+
+ $this->assertEdit(
+ 'MediaWiki:EditPageTest_testCreatePage',
+ null,
+ 'UTSysop',
+ array(
+ 'wpTextbox1' => "",
+ ),
+ EditPage::AS_BLANK_ARTICLE,
+ null,
+ "expected not-registered MediaWiki: page not being created if empty"
);
- $this->assertEdit( 'EditPageTest_testCreatePafe', null, null, $edit,
- EditPage::AS_SUCCESS_NEW_ARTICLE, $text,
- "expected successfull creation with given text" );
+ $this->assertEdit(
+ 'MediaWiki:January',
+ null,
+ 'UTSysop',
+ array(
+ 'wpTextbox1' => "",
+ ),
+ EditPage::AS_SUCCESS_NEW_ARTICLE,
+ "",
+ "expected registered MediaWiki: page being created even if empty"
+ )->doDeleteArticleReal( 'EditPageTest_testCreatePage' );
+
+ $this->assertEdit(
+ 'MediaWiki:Ipb-default-expiry',
+ null,
+ 'UTSysop',
+ array(
+ 'wpTextbox1' => "",
+ ),
+ EditPage::AS_BLANK_ARTICLE,
+ "",
+ "expected registered MediaWiki: page whose default content is empty not being created if empty"
+ );
+
+ $this->assertEdit(
+ 'MediaWiki:January',
+ null,
+ 'UTSysop',
+ array(
+ 'wpTextbox1' => "January",
+ ),
+ EditPage::AS_BLANK_ARTICLE,
+ null,
+ "expected MediaWiki: page not being created if text equals default message"
+ );
}
public function testUpdatePage() {