14 parent::__construct(
$name, $data, $dataName );
16 $this->tablesUsed = array_merge(
37 $this->pages_to_delete =
array();
43 foreach ( $this->pages_to_delete
as $p ) {
48 $p->doDeleteArticle(
"testing done." );
63 if ( is_string(
$title ) ) {
70 $this->pages_to_delete[] = $p;
82 protected function createPage( $page, $text, $model =
null ) {
83 if ( is_string( $page ) || $page instanceof
Title ) {
84 $page = $this->
newPage( $page, $model );
88 $page->doEditContent( $content,
"testing",
EDIT_NEW );
97 $page = $this->
newPage(
"WikiPageTest_testDoEditContent" );
98 $title = $page->getTitle();
101 .
" nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.",
104 $page->doEditContent( $content,
"[[testing]] 1" );
106 $this->assertTrue(
$title->getArticleID() > 0,
"Title object should have new page id" );
107 $this->assertTrue( $page->getId() > 0,
"WikiPage should have new page id" );
108 $this->assertTrue(
$title->exists(),
"Title object should indicate that the page now exists" );
109 $this->assertTrue( $page->exists(),
"WikiPage object should indicate that the page now exists" );
111 $id = $page->getId();
113 # ------------------------
115 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
119 $this->assertEquals( 1,
$n,
'pagelinks should contain one link from the page' );
121 # ------------------------
124 $retrieved = $page->getContent();
125 $this->assertTrue( $content->equals( $retrieved ),
'retrieved content doesn\'t equal original' );
127 # ------------------------
129 .
"Stet clita kasd [[gubergren]], no sea takimata sanctus est.",
132 $page->doEditContent( $content,
"testing 2" );
134 # ------------------------
137 $retrieved = $page->getContent();
138 $this->assertTrue( $content->equals( $retrieved ),
'retrieved content doesn\'t equal original' );
140 # ------------------------
142 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
146 $this->assertEquals( 2,
$n,
'pagelinks should contain two links from the page' );
162 $text =
"[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
163 .
" nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.";
165 $page->doEdit( $text,
"[[testing]] 1" );
167 $this->assertTrue(
$title->getArticleID() > 0,
"Title object should have new page id" );
168 $this->assertTrue( $page->getId() > 0,
"WikiPage should have new page id" );
169 $this->assertTrue(
$title->exists(),
"Title object should indicate that the page now exists" );
170 $this->assertTrue( $page->exists(),
"WikiPage object should indicate that the page now exists" );
172 $id = $page->getId();
174 # ------------------------
176 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
180 $this->assertEquals( 1,
$n,
'pagelinks should contain one link from the page' );
182 # ------------------------
185 $retrieved = $page->getText();
186 $this->assertEquals( $text, $retrieved,
'retrieved text doesn\'t equal original' );
188 # ------------------------
189 $text =
"At vero eos et accusam et justo duo [[dolores]] et ea rebum. "
190 .
"Stet clita kasd [[gubergren]], no sea takimata sanctus est.";
192 $page->doEdit( $text,
"testing 2" );
194 # ------------------------
197 $retrieved = $page->getText();
198 $this->assertEquals( $text, $retrieved,
'retrieved text doesn\'t equal original' );
200 # ------------------------
202 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
206 $this->assertEquals( 2,
$n,
'pagelinks should contain two links from the page' );
218 $page = $this->
createPage(
"Help:WikiPageTest_testDoQuickEdit",
"original text" );
220 $text =
"quick text";
221 $page->doQuickEdit( $text,
$wgUser,
"testing q" );
223 # ---------------------
224 $page =
new WikiPage( $page->getTitle() );
225 $this->assertEquals( $text, $page->getText() );
237 $page->doQuickEditContent( $content,
$wgUser,
"testing q" );
239 # ---------------------
240 $page =
new WikiPage( $page->getTitle() );
241 $this->assertTrue( $content->equals( $page->getContent() ) );
249 $id = $page->getId();
251 $page->doDeleteArticle(
"testing deletion" );
253 $this->assertFalse( $page->getTitle()->getArticleID() > 0,
"Title object should now have page id 0" );
254 $this->assertFalse( $page->getId() > 0,
"WikiPage should now have page id 0" );
255 $this->assertFalse( $page->exists(),
"WikiPage::exists should return false after page was deleted" );
256 $this->assertNull( $page->getContent(),
"WikiPage::getContent should return null after page was deleted" );
257 $this->assertFalse( $page->getText(),
"WikiPage::getText should return false after page was deleted" );
260 $this->assertFalse(
$t->exists(),
"Title::exists should return false after page was deleted" );
262 # ------------------------
264 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
268 $this->assertEquals( 0,
$n,
'pagelinks should contain no more links from the page' );
276 $id = $page->getId();
278 $page->doDeleteUpdates( $id );
280 # ------------------------
282 $res =
$dbr->select(
'pagelinks',
'*',
array(
'pl_from' => $id ) );
286 $this->assertEquals( 0,
$n,
'pagelinks should contain no more links from the page' );
293 $page = $this->
newPage(
"WikiPageTest_testGetRevision" );
295 $rev = $page->getRevision();
296 $this->assertNull(
$rev );
301 $rev = $page->getRevision();
303 $this->assertEquals( $page->getLatest(),
$rev->getId() );
304 $this->assertEquals(
"some text",
$rev->getContent()->getNativeData() );
311 $page = $this->
newPage(
"WikiPageTest_testGetContent" );
313 $content = $page->getContent();
314 $this->assertNull( $content );
319 $content = $page->getContent();
320 $this->assertEquals(
"some text", $content->getNativeData() );
329 $page = $this->
newPage(
"WikiPageTest_testGetText" );
331 $text = $page->getText();
332 $this->assertFalse( $text );
337 $text = $page->getText();
338 $this->assertEquals(
"some text", $text );
347 $page = $this->
newPage(
"WikiPageTest_testGetRawText" );
349 $text = $page->getRawText();
350 $this->assertFalse( $text );
355 $text = $page->getRawText();
356 $this->assertEquals(
"some text", $text );
363 global $wgContentHandlerUseDB;
365 if ( !$wgContentHandlerUseDB ) {
366 $this->markTestSkipped(
'$wgContentHandlerUseDB is disabled' );
371 $page =
new WikiPage( $page->getTitle() );
379 global $wgContentHandlerUseDB;
381 if ( !$wgContentHandlerUseDB ) {
382 $this->markTestSkipped(
'$wgContentHandlerUseDB is disabled' );
387 $page =
new WikiPage( $page->getTitle() );
388 $this->assertEquals(
'JavaScriptContentHandler', get_class( $page->getContentHandler() ) );
395 $page = $this->
newPage(
"WikiPageTest_testExists" );
396 $this->assertFalse( $page->exists() );
400 $this->assertTrue( $page->exists() );
402 $page =
new WikiPage( $page->getTitle() );
403 $this->assertTrue( $page->exists() );
407 $this->assertFalse( $page->exists() );
409 $page =
new WikiPage( $page->getTitle() );
410 $this->assertFalse( $page->exists() );
415 array(
'WikiPageTest_testHasViewableContent',
false,
true ),
416 array(
'Special:WikiPageTest_testHasViewableContent',
false ),
417 array(
'MediaWiki:WikiPageTest_testHasViewableContent',
false ),
418 array(
'Special:Userlogin',
true ),
419 array(
'MediaWiki:help',
true ),
429 $this->assertEquals( $viewable, $page->hasViewableContent() );
433 $this->assertTrue( $page->hasViewableContent() );
435 $page =
new WikiPage( $page->getTitle() );
436 $this->assertTrue( $page->hasViewableContent() );
454 # sanity check, because this test seems to fail for no reason for some people.
455 $c = $page->getContent();
456 $this->assertEquals(
'WikitextContent', get_class( $c ) );
458 # now, test the actual redirect
459 $t = $page->getRedirectTarget();
460 $this->assertEquals( $target, is_null(
$t ) ?
null :
$t->getPrefixedText() );
469 $this->assertEquals( !is_null( $target ), $page->isRedirect() );
476 array(
'WikiPageTest_testIsCountable',
482 array(
'WikiPageTest_testIsCountable',
490 array(
'WikiPageTest_testIsCountable',
496 array(
'WikiPageTest_testIsCountable',
504 array(
'WikiPageTest_testIsCountable',
510 array(
'WikiPageTest_testIsCountable',
518 array(
'WikiPageTest_testIsCountable',
524 array(
'WikiPageTest_testIsCountable',
530 array(
'WikiPageTest_testIsCountable',
538 array(
'Talk:WikiPageTest_testIsCountable',
544 array(
'Talk:WikiPageTest_testIsCountable',
550 array(
'Talk:WikiPageTest_testIsCountable',
558 array(
'MediaWiki:WikiPageTest_testIsCountable.js',
564 array(
'MediaWiki:WikiPageTest_testIsCountable.js',
570 array(
'MediaWiki:WikiPageTest_testIsCountable.js',
584 global $wgContentHandlerUseDB;
591 $this->markTestSkipped(
"Can not use non-default content model $model for "
592 .
$title->getPrefixedDBkey() .
" with \$wgContentHandlerUseDB disabled." );
597 $editInfo = $page->prepareContentForEdit( $page->getContent() );
599 $v = $page->isCountable();
600 $w = $page->isCountable( $editInfo );
602 $this->assertEquals( $expected, $v,
"isCountable( null ) returned unexpected value " . var_export( $v,
true )
603 .
" instead of " . var_export( $expected,
true ) .
" in mode `$mode` for text \"$text\"" );
605 $this->assertEquals( $expected, $w,
"isCountable( \$editInfo ) returned unexpected value " . var_export( $v,
true )
606 .
" instead of " . var_export( $expected,
true ) .
" in mode `$mode` for text \"$text\"" );
621 $page = $this->
createPage(
'WikiPageTest_testGetParserOutput', $text, $model );
623 $opt = $page->makeParserOptions(
'canonical' );
624 $po = $page->getParserOutput( $opt );
625 $text = $po->getText();
627 $text = trim( preg_replace(
'/<!--.*?-->/sm',
'', $text ) ); # strip injected comments
628 $text = preg_replace(
'!\s*(</p>)!sm',
'\1', $text ); # don
't let tidy confuse us
630 $this->assertEquals( $expectedHtml, $text );
638 public function testGetParserOutput_nonexisting() {
642 $page = new WikiPage( new Title( "WikiPageTest_testGetParserOutput_nonexisting_$count" ) );
644 $opt = new ParserOptions();
645 $po = $page->getParserOutput( $opt );
647 $this->assertFalse( $po, "getParserOutput() shall return false for non-existing pages." );
653 public function testGetParserOutput_badrev() {
654 $page = $this->createPage( 'WikiPageTest_testGetParserOutput
', "dummy", CONTENT_MODEL_WIKITEXT );
656 $opt = new ParserOptions();
657 $po = $page->getParserOutput( $opt, $page->getLatest() + 1234 );
659 // @todo would be neat to also test deleted revision
661 $this->assertFalse( $po, "getParserOutput() shall return false for non-existing revisions." );
678 public function dataReplaceSection() {
679 //NOTE: assume the Help namespace to contain wikitext
681 array( 'Help:WikiPageTest_testReplaceSection
',
682 CONTENT_MODEL_WIKITEXT,
683 WikiPageTest::$sections,
687 trim( preg_replace( '/^Intro/sm
', 'No more
', WikiPageTest::$sections ) )
689 array( 'Help:WikiPageTest_testReplaceSection
',
690 CONTENT_MODEL_WIKITEXT,
691 WikiPageTest::$sections,
697 array( 'Help:WikiPageTest_testReplaceSection
',
698 CONTENT_MODEL_WIKITEXT,
699 WikiPageTest::$sections,
701 "== TEST ==\nmore fun",
703 trim( preg_replace( '/^== test ==.*== foo ==/sm
',
704 "== TEST ==\nmore fun\n\n== foo ==",
705 WikiPageTest::$sections ) )
707 array( 'Help:WikiPageTest_testReplaceSection
',
708 CONTENT_MODEL_WIKITEXT,
709 WikiPageTest::$sections,
713 trim( WikiPageTest::$sections )
715 array( 'Help:WikiPageTest_testReplaceSection
',
716 CONTENT_MODEL_WIKITEXT,
717 WikiPageTest::$sections,
721 trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more"
730 public function testReplaceSection( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
731 $this->hideDeprecated( "WikiPage::replaceSection" );
733 $page = $this->createPage( $title, $text, $model );
734 $text = $page->replaceSection( $section, $with, $sectionTitle );
735 $text = trim( $text );
737 $this->assertEquals( $expected, $text );
744 public function testReplaceSectionContent( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
745 $page = $this->createPage( $title, $text, $model );
747 $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() );
748 $c = $page->replaceSectionContent( $section, $content, $sectionTitle );
750 $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
753 /* @todo FIXME: fix this!
754 public function testGetUndoText() {
755 $this->checkHasDiff3();
758 $page = $this->createPage( "WikiPageTest_testGetUndoText", $text );
759 $rev1 = $page->getRevision();
762 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section two");
763 $rev2 = $page->getRevision();
765 $text .= "\n\nthree";
766 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section three");
767 $rev3 = $page->getRevision();
770 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section four");
771 $rev4 = $page->getRevision();
774 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section five");
775 $rev5 = $page->getRevision();
778 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section six");
779 $rev6 = $page->getRevision();
781 $undo6 = $page->getUndoText( $rev6 );
782 if ( $undo6 === false ) $this->fail( "getUndoText failed for rev6" );
783 $this->assertEquals( "one\n\ntwo\n\nthree\n\nfour\n\nfive", $undo6 );
785 $undo3 = $page->getUndoText( $rev4, $rev2 );
786 if ( $undo3 === false ) $this->fail( "getUndoText failed for rev4..rev2" );
787 $this->assertEquals( "one\n\ntwo\n\nfive", $undo3 );
789 $undo2 = $page->getUndoText( $rev2 );
790 if ( $undo2 === false ) $this->fail( "getUndoText failed for rev2" );
791 $this->assertEquals( "one\n\nfive", $undo2 );
798 public function broken_testDoRollback() {
800 $admin->setName( "Admin" );
803 $page = $this->newPage( "WikiPageTest_testDoRollback" );
804 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
805 "section one", EDIT_NEW, false, $admin );
808 $user1->setName( "127.0.1.11" );
810 $page = new WikiPage( $page->getTitle() );
811 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
812 "adding section two", 0, false, $user1 );
815 $user2->setName( "127.0.2.13" );
816 $text .= "\n\nthree";
817 $page = new WikiPage( $page->getTitle() );
818 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
819 "adding section three", 0, false, $user2 );
821 # we are having issues with doRollback spuriously failing. apparently the last revision somehow goes missing
822 # or not committed under some circumstances. so, make sure the last revision has the right user name.
823 $dbr = wfGetDB( DB_SLAVE );
824 $this->assertEquals( 3, Revision::countByPageId( $dbr, $page->getId() ) );
826 $page = new WikiPage( $page->getTitle() );
827 $rev3 = $page->getRevision();
828 $this->assertEquals( '127.0.2.13
', $rev3->getUserText() );
830 $rev2 = $rev3->getPrevious();
831 $this->assertEquals( '127.0.1.11
', $rev2->getUserText() );
833 $rev1 = $rev2->getPrevious();
834 $this->assertEquals( 'Admin
', $rev1->getUserText() );
836 # now, try the actual rollback
837 $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
838 $token = $admin->getEditToken( array( $page->getTitle()->getPrefixedText(), $user2->getName() ), null );
839 $errors = $page->doRollback( $user2->getName(), "testing revert", $token, false, $details, $admin );
842 $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
845 $page = new WikiPage( $page->getTitle() );
846 $this->assertEquals( $rev2->getSha1(), $page->getRevision()->getSha1(),
847 "rollback did not revert to the correct revision" );
848 $this->assertEquals( "one\n\ntwo", $page->getContent()->getNativeData() );
855 public function testDoRollback() {
857 $admin->setName( "Admin" );
860 $page = $this->newPage( "WikiPageTest_testDoRollback" );
861 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
862 "section one", EDIT_NEW, false, $admin );
863 $rev1 = $page->getRevision();
866 $user1->setName( "127.0.1.11" );
868 $page = new WikiPage( $page->getTitle() );
869 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
870 "adding section two", 0, false, $user1 );
872 # now, try the rollback
873 $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
874 $token = $admin->getEditToken( array( $page->getTitle()->getPrefixedText(), $user1->getName() ), null );
875 $errors = $page->doRollback( $user1->getName(), "testing revert", $token, false, $details, $admin );
878 $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
881 $page = new WikiPage( $page->getTitle() );
882 $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(),
883 "rollback did not revert to the correct revision" );
884 $this->assertEquals( "one", $page->getContent()->getNativeData() );
890 public function testDoRollbackFailureSameContent() {
892 $admin->setName( "Admin" );
893 $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
896 $page = $this->newPage( "WikiPageTest_testDoRollback" );
897 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
898 "section one", EDIT_NEW, false, $admin );
899 $rev1 = $page->getRevision();
902 $user1->setName( "127.0.1.11" );
903 $user1->addGroup( "sysop" ); #XXX: make the test user a sysop...
905 $page = new WikiPage( $page->getTitle() );
906 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
907 "adding section two", 0, false, $user1 );
909 # now, do a the rollback from the same user was doing the edit before
910 $resultDetails = array();
911 $token = $user1->getEditToken( array( $page->getTitle()->getPrefixedText(), $user1->getName() ), null );
912 $errors = $page->doRollback( $user1->getName(), "testing revert same user", $token, false, $resultDetails, $admin );
914 $this->assertEquals( array(), $errors, "Rollback failed same user" );
916 # now, try the rollback
917 $resultDetails = array();
918 $token = $admin->getEditToken( array( $page->getTitle()->getPrefixedText(), $user1->getName() ), null );
919 $errors = $page->doRollback( $user1->getName(), "testing revert", $token, false, $resultDetails, $admin );
922 '127.0.1.11
', 'Admin
' ) ), $errors, "Rollback not failed" );
924 $page = new WikiPage( $page->getTitle() );
925 $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(),
926 "rollback did not revert to the correct revision" );
927 $this->assertEquals( "one", $page->getContent()->getNativeData() );
930 public static function provideGetAutosummary() {
933 'Hello
there, world!
',
936 '/^Redirected
page .*Foo/
'
943 '/^Created
page .*Hello/
'
947 'Hello
there, world!
',
954 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
955 labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et
956 ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
',
959 '/^Replaced .*Hello/
'
975 public function testGetAutosummary( $old, $new, $flags, $expected ) {
976 $this->hideDeprecated( "WikiPage::getAutosummary" );
978 $page = $this->newPage( "WikiPageTest_testGetAutosummary" );
980 $summary = $page->getAutosummary( $old, $new, $flags );
982 $this->assertTrue( (bool)preg_match( $expected, $summary ),
983 "Autosummary didn't match expected pattern $expected:
$summary" );
986 public static function provideGetAutoDeleteReason() {
996 array( "first edit
", null ),
998 "/first edit.*
only contributor/
",
1004 array( "first edit
", null ),
1005 array( "second edit
", null ),
1007 "/second edit.*
only contributor/
",
1013 array( "first edit
", "127.0.2.22
" ),
1014 array( "second edit
", "127.0.3.33
" ),
1022 array( "first edit:
"
1023 . "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
"
1024 . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
"
1025 . "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
"
1026 . "takimata sanctus est Lorem ipsum dolor sit amet.
'", null ),
1028 '/first edit:.*\.\.\.
"/',
1034 array( "first edit
", "127.0.2.22
" ),
1035 array( "", "127.0.3.33
" ),
1037 "/before blanking.*first edit/
",
1048 public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) {
1051 //NOTE: assume Help namespace to contain wikitext
1052 $page = $this->newPage( "Help:WikiPageTest_testGetAutoDeleteReason
" );
1056 foreach ( $edits as $edit ) {
1059 if ( !empty( $edit[1] ) ) {
1060 $user->setName( $edit[1] );
1065 $content = ContentHandler::makeContent( $edit[0], $page->getTitle(), $page->getContentModel() );
1067 $page->doEditContent( $content, "test edit $c
", $c < 2 ? EDIT_NEW : 0, false, $user );
1072 $reason = $page->getAutoDeleteReason( $hasHistory );
1074 if ( is_bool( $expectedResult ) || is_null( $expectedResult ) ) {
1075 $this->assertEquals( $expectedResult, $reason );
1077 $this->assertTrue( (bool)preg_match( $expectedResult, $reason ),
1078 "Autosummary didn
't match expected pattern $expectedResult: $reason" );
1081 $this->assertEquals( $expectedHistory, $hasHistory,
1082 "expected \$hasHistory to be " . var_export( $expectedHistory, true ) );
1084 $page->doDeleteArticle( "done" );
1087 public static function providePreSaveTransform() {
1089 array( 'hello
this is ~~~
',
1090 "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
1092 array( 'hello \
'\'this\
'\' is <nowiki>~~~</nowiki>
',
1093 'hello \
'\'this\
'\' is <nowiki>~~~</nowiki>
',
1102 public function testPreSaveTransform( $text, $expected ) {
1105 $user->setName( "127.0.0.1" );
1107 //NOTE: assume Help namespace to contain wikitext
1108 $page = $this->newPage( "Help:WikiPageTest_testPreloadTransform" );
1109 $text = $page->preSaveTransform( $text, $user );
1111 $this->assertEquals( $expected, $text );
1117 public function testWikiPageFactory() {
1118 $title = Title::makeTitle( NS_FILE, 'Someimage.png
' );
1119 $page = WikiPage::factory( $title );
1120 $this->assertEquals( 'WikiFilePage', get_class( $page ) );
1122 $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory
' );
1123 $page = WikiPage::factory( $title );
1126 $title = Title::makeTitle( NS_MAIN, 'SomePage
' );
1127 $page = WikiPage::factory( $title );
1128 $this->assertEquals( 'WikiPage', get_class( $page ) );