General cleanup of Parser tests
[lhc/web/wiklou.git] / tests / phpunit / includes / EditPageTest.php
index 00eba30..76ef782 100644 (file)
@@ -9,7 +9,7 @@
  * @group medium
  *        ^--- tell phpunit that these test cases may take longer than 2 seconds.
  */
-class EditPageTest extends MediaWikiTestCase {
+class EditPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideExtractSectionTitle
@@ -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() {