MediaWiki  1.23.2
WikiPageTest.php
Go to the documentation of this file.
1 <?php
2 
10 
11  protected $pages_to_delete;
12 
13  function __construct( $name = null, array $data = array(), $dataName = '' ) {
14  parent::__construct( $name, $data, $dataName );
15 
16  $this->tablesUsed = array_merge(
17  $this->tablesUsed,
18  array( 'page',
19  'revision',
20  'text',
21 
22  'recentchanges',
23  'logging',
24 
25  'page_props',
26  'pagelinks',
27  'categorylinks',
28  'langlinks',
29  'externallinks',
30  'imagelinks',
31  'templatelinks',
32  'iwlinks' ) );
33  }
34 
35  protected function setUp() {
36  parent::setUp();
37  $this->pages_to_delete = array();
38 
39  LinkCache::singleton()->clear(); # avoid cached redirect status, etc
40  }
41 
42  protected function tearDown() {
43  foreach ( $this->pages_to_delete as $p ) {
44  /* @var $p WikiPage */
45 
46  try {
47  if ( $p->exists() ) {
48  $p->doDeleteArticle( "testing done." );
49  }
50  } catch ( MWException $ex ) {
51  // fail silently
52  }
53  }
54  parent::tearDown();
55  }
56 
62  protected function newPage( $title, $model = null ) {
63  if ( is_string( $title ) ) {
64  $ns = $this->getDefaultWikitextNS();
66  }
67 
68  $p = new WikiPage( $title );
69 
70  $this->pages_to_delete[] = $p;
71 
72  return $p;
73  }
74 
82  protected function createPage( $page, $text, $model = null ) {
83  if ( is_string( $page ) || $page instanceof Title ) {
84  $page = $this->newPage( $page, $model );
85  }
86 
87  $content = ContentHandler::makeContent( $text, $page->getTitle(), $model );
88  $page->doEditContent( $content, "testing", EDIT_NEW );
89 
90  return $page;
91  }
92 
96  public function testDoEditContent() {
97  $page = $this->newPage( "WikiPageTest_testDoEditContent" );
98  $title = $page->getTitle();
99 
100  $content = ContentHandler::makeContent( "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
101  . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.",
103 
104  $page->doEditContent( $content, "[[testing]] 1" );
105 
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" );
110 
111  $id = $page->getId();
112 
113  # ------------------------
114  $dbr = wfGetDB( DB_SLAVE );
115  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
116  $n = $res->numRows();
117  $res->free();
118 
119  $this->assertEquals( 1, $n, 'pagelinks should contain one link from the page' );
120 
121  # ------------------------
122  $page = new WikiPage( $title );
123 
124  $retrieved = $page->getContent();
125  $this->assertTrue( $content->equals( $retrieved ), 'retrieved content doesn\'t equal original' );
126 
127  # ------------------------
128  $content = ContentHandler::makeContent( "At vero eos et accusam et justo duo [[dolores]] et ea rebum. "
129  . "Stet clita kasd [[gubergren]], no sea takimata sanctus est.",
131 
132  $page->doEditContent( $content, "testing 2" );
133 
134  # ------------------------
135  $page = new WikiPage( $title );
136 
137  $retrieved = $page->getContent();
138  $this->assertTrue( $content->equals( $retrieved ), 'retrieved content doesn\'t equal original' );
139 
140  # ------------------------
141  $dbr = wfGetDB( DB_SLAVE );
142  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
143  $n = $res->numRows();
144  $res->free();
145 
146  $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' );
147  }
148 
152  public function testDoEdit() {
153  $this->hideDeprecated( "WikiPage::doEdit" );
154  $this->hideDeprecated( "WikiPage::getText" );
155  $this->hideDeprecated( "Revision::getText" );
156 
157  //NOTE: assume help namespace will default to wikitext
158  $title = Title::newFromText( "Help:WikiPageTest_testDoEdit" );
159 
160  $page = $this->newPage( $title );
161 
162  $text = "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
163  . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.";
164 
165  $page->doEdit( $text, "[[testing]] 1" );
166 
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" );
171 
172  $id = $page->getId();
173 
174  # ------------------------
175  $dbr = wfGetDB( DB_SLAVE );
176  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
177  $n = $res->numRows();
178  $res->free();
179 
180  $this->assertEquals( 1, $n, 'pagelinks should contain one link from the page' );
181 
182  # ------------------------
183  $page = new WikiPage( $title );
184 
185  $retrieved = $page->getText();
186  $this->assertEquals( $text, $retrieved, 'retrieved text doesn\'t equal original' );
187 
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.";
191 
192  $page->doEdit( $text, "testing 2" );
193 
194  # ------------------------
195  $page = new WikiPage( $title );
196 
197  $retrieved = $page->getText();
198  $this->assertEquals( $text, $retrieved, 'retrieved text doesn\'t equal original' );
199 
200  # ------------------------
201  $dbr = wfGetDB( DB_SLAVE );
202  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
203  $n = $res->numRows();
204  $res->free();
205 
206  $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' );
207  }
208 
212  public function testDoQuickEdit() {
213  global $wgUser;
214 
215  $this->hideDeprecated( "WikiPage::doQuickEdit" );
216 
217  //NOTE: assume help namespace will default to wikitext
218  $page = $this->createPage( "Help:WikiPageTest_testDoQuickEdit", "original text" );
219 
220  $text = "quick text";
221  $page->doQuickEdit( $text, $wgUser, "testing q" );
222 
223  # ---------------------
224  $page = new WikiPage( $page->getTitle() );
225  $this->assertEquals( $text, $page->getText() );
226  }
227 
231  public function testDoQuickEditContent() {
232  global $wgUser;
233 
234  $page = $this->createPage( "WikiPageTest_testDoQuickEditContent", "original text", CONTENT_MODEL_WIKITEXT );
235 
236  $content = ContentHandler::makeContent( "quick text", $page->getTitle(), CONTENT_MODEL_WIKITEXT );
237  $page->doQuickEditContent( $content, $wgUser, "testing q" );
238 
239  # ---------------------
240  $page = new WikiPage( $page->getTitle() );
241  $this->assertTrue( $content->equals( $page->getContent() ) );
242  }
243 
247  public function testDoDeleteArticle() {
248  $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT );
249  $id = $page->getId();
250 
251  $page->doDeleteArticle( "testing deletion" );
252 
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" );
258 
259  $t = Title::newFromText( $page->getTitle()->getPrefixedText() );
260  $this->assertFalse( $t->exists(), "Title::exists should return false after page was deleted" );
261 
262  # ------------------------
263  $dbr = wfGetDB( DB_SLAVE );
264  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
265  $n = $res->numRows();
266  $res->free();
267 
268  $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
269  }
270 
274  public function testDoDeleteUpdates() {
275  $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT );
276  $id = $page->getId();
277 
278  $page->doDeleteUpdates( $id );
279 
280  # ------------------------
281  $dbr = wfGetDB( DB_SLAVE );
282  $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
283  $n = $res->numRows();
284  $res->free();
285 
286  $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
287  }
288 
292  public function testGetRevision() {
293  $page = $this->newPage( "WikiPageTest_testGetRevision" );
294 
295  $rev = $page->getRevision();
296  $this->assertNull( $rev );
297 
298  # -----------------
299  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
300 
301  $rev = $page->getRevision();
302 
303  $this->assertEquals( $page->getLatest(), $rev->getId() );
304  $this->assertEquals( "some text", $rev->getContent()->getNativeData() );
305  }
306 
310  public function testGetContent() {
311  $page = $this->newPage( "WikiPageTest_testGetContent" );
312 
313  $content = $page->getContent();
314  $this->assertNull( $content );
315 
316  # -----------------
317  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
318 
319  $content = $page->getContent();
320  $this->assertEquals( "some text", $content->getNativeData() );
321  }
322 
326  public function testGetText() {
327  $this->hideDeprecated( "WikiPage::getText" );
328 
329  $page = $this->newPage( "WikiPageTest_testGetText" );
330 
331  $text = $page->getText();
332  $this->assertFalse( $text );
333 
334  # -----------------
335  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
336 
337  $text = $page->getText();
338  $this->assertEquals( "some text", $text );
339  }
340 
344  public function testGetRawText() {
345  $this->hideDeprecated( "WikiPage::getRawText" );
346 
347  $page = $this->newPage( "WikiPageTest_testGetRawText" );
348 
349  $text = $page->getRawText();
350  $this->assertFalse( $text );
351 
352  # -----------------
353  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
354 
355  $text = $page->getRawText();
356  $this->assertEquals( "some text", $text );
357  }
358 
362  public function testGetContentModel() {
363  global $wgContentHandlerUseDB;
364 
365  if ( !$wgContentHandlerUseDB ) {
366  $this->markTestSkipped( '$wgContentHandlerUseDB is disabled' );
367  }
368 
369  $page = $this->createPage( "WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT );
370 
371  $page = new WikiPage( $page->getTitle() );
372  $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $page->getContentModel() );
373  }
374 
378  public function testGetContentHandler() {
379  global $wgContentHandlerUseDB;
380 
381  if ( !$wgContentHandlerUseDB ) {
382  $this->markTestSkipped( '$wgContentHandlerUseDB is disabled' );
383  }
384 
385  $page = $this->createPage( "WikiPageTest_testGetContentHandler", "some text", CONTENT_MODEL_JAVASCRIPT );
386 
387  $page = new WikiPage( $page->getTitle() );
388  $this->assertEquals( 'JavaScriptContentHandler', get_class( $page->getContentHandler() ) );
389  }
390 
394  public function testExists() {
395  $page = $this->newPage( "WikiPageTest_testExists" );
396  $this->assertFalse( $page->exists() );
397 
398  # -----------------
399  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
400  $this->assertTrue( $page->exists() );
401 
402  $page = new WikiPage( $page->getTitle() );
403  $this->assertTrue( $page->exists() );
404 
405  # -----------------
406  $page->doDeleteArticle( "done testing" );
407  $this->assertFalse( $page->exists() );
408 
409  $page = new WikiPage( $page->getTitle() );
410  $this->assertFalse( $page->exists() );
411  }
412 
413  public static function provideHasViewableContent() {
414  return array(
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 ),
420  );
421  }
422 
427  public function testHasViewableContent( $title, $viewable, $create = false ) {
428  $page = $this->newPage( $title );
429  $this->assertEquals( $viewable, $page->hasViewableContent() );
430 
431  if ( $create ) {
432  $this->createPage( $page, "some text", CONTENT_MODEL_WIKITEXT );
433  $this->assertTrue( $page->hasViewableContent() );
434 
435  $page = new WikiPage( $page->getTitle() );
436  $this->assertTrue( $page->hasViewableContent() );
437  }
438  }
439 
440  public static function provideGetRedirectTarget() {
441  return array(
442  array( 'WikiPageTest_testGetRedirectTarget_1', CONTENT_MODEL_WIKITEXT, "hello world", null ),
443  array( 'WikiPageTest_testGetRedirectTarget_2', CONTENT_MODEL_WIKITEXT, "#REDIRECT [[hello world]]", "Hello world" ),
444  );
445  }
446 
451  public function testGetRedirectTarget( $title, $model, $text, $target ) {
452  $page = $this->createPage( $title, $text, $model );
453 
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 ) );
457 
458  # now, test the actual redirect
459  $t = $page->getRedirectTarget();
460  $this->assertEquals( $target, is_null( $t ) ? null : $t->getPrefixedText() );
461  }
462 
467  public function testIsRedirect( $title, $model, $text, $target ) {
468  $page = $this->createPage( $title, $text, $model );
469  $this->assertEquals( !is_null( $target ), $page->isRedirect() );
470  }
471 
472  public static function provideIsCountable() {
473  return array(
474 
475  // any
476  array( 'WikiPageTest_testIsCountable',
478  '',
479  'any',
480  true
481  ),
482  array( 'WikiPageTest_testIsCountable',
484  'Foo',
485  'any',
486  true
487  ),
488 
489  // comma
490  array( 'WikiPageTest_testIsCountable',
492  'Foo',
493  'comma',
494  false
495  ),
496  array( 'WikiPageTest_testIsCountable',
498  'Foo, bar',
499  'comma',
500  true
501  ),
502 
503  // link
504  array( 'WikiPageTest_testIsCountable',
506  'Foo',
507  'link',
508  false
509  ),
510  array( 'WikiPageTest_testIsCountable',
512  'Foo [[bar]]',
513  'link',
514  true
515  ),
516 
517  // redirects
518  array( 'WikiPageTest_testIsCountable',
520  '#REDIRECT [[bar]]',
521  'any',
522  false
523  ),
524  array( 'WikiPageTest_testIsCountable',
526  '#REDIRECT [[bar]]',
527  'comma',
528  false
529  ),
530  array( 'WikiPageTest_testIsCountable',
532  '#REDIRECT [[bar]]',
533  'link',
534  false
535  ),
536 
537  // not a content namespace
538  array( 'Talk:WikiPageTest_testIsCountable',
540  'Foo',
541  'any',
542  false
543  ),
544  array( 'Talk:WikiPageTest_testIsCountable',
546  'Foo, bar',
547  'comma',
548  false
549  ),
550  array( 'Talk:WikiPageTest_testIsCountable',
552  'Foo [[bar]]',
553  'link',
554  false
555  ),
556 
557  // not a content namespace, different model
558  array( 'MediaWiki:WikiPageTest_testIsCountable.js',
559  null,
560  'Foo',
561  'any',
562  false
563  ),
564  array( 'MediaWiki:WikiPageTest_testIsCountable.js',
565  null,
566  'Foo, bar',
567  'comma',
568  false
569  ),
570  array( 'MediaWiki:WikiPageTest_testIsCountable.js',
571  null,
572  'Foo [[bar]]',
573  'link',
574  false
575  ),
576  );
577  }
578 
583  public function testIsCountable( $title, $model, $text, $mode, $expected ) {
584  global $wgContentHandlerUseDB;
585 
586  $this->setMwGlobals( 'wgArticleCountMethod', $mode );
587 
589 
590  if ( !$wgContentHandlerUseDB && $model && ContentHandler::getDefaultModelFor( $title ) != $model ) {
591  $this->markTestSkipped( "Can not use non-default content model $model for "
592  . $title->getPrefixedDBkey() . " with \$wgContentHandlerUseDB disabled." );
593  }
594 
595  $page = $this->createPage( $title, $text, $model );
596 
597  $editInfo = $page->prepareContentForEdit( $page->getContent() );
598 
599  $v = $page->isCountable();
600  $w = $page->isCountable( $editInfo );
601 
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\"" );
604 
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\"" );
607  }
608 
609  public static function provideGetParserOutput() {
610  return array(
611  array( CONTENT_MODEL_WIKITEXT, "hello ''world''\n", "<p>hello <i>world</i></p>" ),
612  // @todo more...?
613  );
614  }
615 
620  public function testGetParserOutput( $model, $text, $expectedHtml ) {
621  $page = $this->createPage( 'WikiPageTest_testGetParserOutput', $text, $model );
622 
623  $opt = $page->makeParserOptions( 'canonical' );
624  $po = $page->getParserOutput( $opt );
625  $text = $po->getText();
626 
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
629 
630  $this->assertEquals( $expectedHtml, $text );
631 
632  return $po;
633  }
634 
638  public function testGetParserOutput_nonexisting() {
639  static $count = 0;
640  $count++;
641 
642  $page = new WikiPage( new Title( "WikiPageTest_testGetParserOutput_nonexisting_$count" ) );
643 
644  $opt = new ParserOptions();
645  $po = $page->getParserOutput( $opt );
646 
647  $this->assertFalse( $po, "getParserOutput() shall return false for non-existing pages." );
648  }
649 
653  public function testGetParserOutput_badrev() {
654  $page = $this->createPage( 'WikiPageTest_testGetParserOutput', "dummy", CONTENT_MODEL_WIKITEXT );
655 
656  $opt = new ParserOptions();
657  $po = $page->getParserOutput( $opt, $page->getLatest() + 1234 );
658 
659  // @todo would be neat to also test deleted revision
660 
661  $this->assertFalse( $po, "getParserOutput() shall return false for non-existing revisions." );
662  }
663 
664  static $sections =
665 
666  "Intro
667 
668 == stuff ==
669 hello world
670 
671 == test ==
672 just a test
673 
674 == foo ==
675 more stuff
676 ";
677 
678  public function dataReplaceSection() {
679  //NOTE: assume the Help namespace to contain wikitext
680  return array(
681  array( 'Help:WikiPageTest_testReplaceSection',
682  CONTENT_MODEL_WIKITEXT,
683  WikiPageTest::$sections,
684  "0",
685  "No more",
686  null,
687  trim( preg_replace( '/^Intro/sm', 'No more', WikiPageTest::$sections ) )
688  ),
689  array( 'Help:WikiPageTest_testReplaceSection',
690  CONTENT_MODEL_WIKITEXT,
691  WikiPageTest::$sections,
692  "",
693  "No more",
694  null,
695  "No more"
696  ),
697  array( 'Help:WikiPageTest_testReplaceSection',
698  CONTENT_MODEL_WIKITEXT,
699  WikiPageTest::$sections,
700  "2",
701  "== TEST ==\nmore fun",
702  null,
703  trim( preg_replace( '/^== test ==.*== foo ==/sm',
704  "== TEST ==\nmore fun\n\n== foo ==",
705  WikiPageTest::$sections ) )
706  ),
707  array( 'Help:WikiPageTest_testReplaceSection',
708  CONTENT_MODEL_WIKITEXT,
709  WikiPageTest::$sections,
710  "8",
711  "No more",
712  null,
713  trim( WikiPageTest::$sections )
714  ),
715  array( 'Help:WikiPageTest_testReplaceSection',
716  CONTENT_MODEL_WIKITEXT,
717  WikiPageTest::$sections,
718  "new",
719  "No more",
720  "New",
721  trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more"
722  ),
723  );
724  }
725 
730  public function testReplaceSection( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
731  $this->hideDeprecated( "WikiPage::replaceSection" );
732 
733  $page = $this->createPage( $title, $text, $model );
734  $text = $page->replaceSection( $section, $with, $sectionTitle );
735  $text = trim( $text );
736 
737  $this->assertEquals( $expected, $text );
738  }
739 
744  public function testReplaceSectionContent( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
745  $page = $this->createPage( $title, $text, $model );
746 
747  $content = ContentHandler::makeContent( $with, $page->getTitle(), $page->getContentModel() );
748  $c = $page->replaceSectionContent( $section, $content, $sectionTitle );
749 
750  $this->assertEquals( $expected, is_null( $c ) ? null : trim( $c->getNativeData() ) );
751  }
752 
753  /* @todo FIXME: fix this!
754  public function testGetUndoText() {
755  $this->checkHasDiff3();
756 
757  $text = "one";
758  $page = $this->createPage( "WikiPageTest_testGetUndoText", $text );
759  $rev1 = $page->getRevision();
760 
761  $text .= "\n\ntwo";
762  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section two");
763  $rev2 = $page->getRevision();
764 
765  $text .= "\n\nthree";
766  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section three");
767  $rev3 = $page->getRevision();
768 
769  $text .= "\n\nfour";
770  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section four");
771  $rev4 = $page->getRevision();
772 
773  $text .= "\n\nfive";
774  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section five");
775  $rev5 = $page->getRevision();
776 
777  $text .= "\n\nsix";
778  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section six");
779  $rev6 = $page->getRevision();
780 
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 );
784 
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 );
788 
789  $undo2 = $page->getUndoText( $rev2 );
790  if ( $undo2 === false ) $this->fail( "getUndoText failed for rev2" );
791  $this->assertEquals( "one\n\nfive", $undo2 );
792  }
793  */
794 
798  public function broken_testDoRollback() {
799  $admin = new User();
800  $admin->setName( "Admin" );
801 
802  $text = "one";
803  $page = $this->newPage( "WikiPageTest_testDoRollback" );
804  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
805  "section one", EDIT_NEW, false, $admin );
806 
807  $user1 = new User();
808  $user1->setName( "127.0.1.11" );
809  $text .= "\n\ntwo";
810  $page = new WikiPage( $page->getTitle() );
811  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ),
812  "adding section two", 0, false, $user1 );
813 
814  $user2 = new User();
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 );
820 
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() ) );
825 
826  $page = new WikiPage( $page->getTitle() );
827  $rev3 = $page->getRevision();
828  $this->assertEquals( '127.0.2.13', $rev3->getUserText() );
829 
830  $rev2 = $rev3->getPrevious();
831  $this->assertEquals( '127.0.1.11', $rev2->getUserText() );
832 
833  $rev1 = $rev2->getPrevious();
834  $this->assertEquals( 'Admin', $rev1->getUserText() );
835 
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 );
840 
841  if ( $errors ) {
842  $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
843  }
844 
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() );
849  }
850 
855  public function testDoRollback() {
856  $admin = new User();
857  $admin->setName( "Admin" );
858 
859  $text = "one";
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();
864 
865  $user1 = new User();
866  $user1->setName( "127.0.1.11" );
867  $text .= "\n\ntwo";
868  $page = new WikiPage( $page->getTitle() );
869  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
870  "adding section two", 0, false, $user1 );
871 
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 );
876 
877  if ( $errors ) {
878  $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
879  }
880 
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() );
885  }
886 
890  public function testDoRollbackFailureSameContent() {
891  $admin = new User();
892  $admin->setName( "Admin" );
893  $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
894 
895  $text = "one";
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();
900 
901  $user1 = new User();
902  $user1->setName( "127.0.1.11" );
903  $user1->addGroup( "sysop" ); #XXX: make the test user a sysop...
904  $text .= "\n\ntwo";
905  $page = new WikiPage( $page->getTitle() );
906  $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle(), CONTENT_MODEL_WIKITEXT ),
907  "adding section two", 0, false, $user1 );
908 
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 );
913 
914  $this->assertEquals( array(), $errors, "Rollback failed same user" );
915 
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 );
920 
921  $this->assertEquals( array( array( 'alreadyrolled', 'WikiPageTest testDoRollback',
922  '127.0.1.11', 'Admin' ) ), $errors, "Rollback not failed" );
923 
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() );
928  }
929 
930  public static function provideGetAutosummary() {
931  return array(
932  array(
933  'Hello there, world!',
934  '#REDIRECT [[Foo]]',
935  0,
936  '/^Redirected page .*Foo/'
937  ),
938 
939  array(
940  null,
941  'Hello world!',
942  EDIT_NEW,
943  '/^Created page .*Hello/'
944  ),
945 
946  array(
947  'Hello there, world!',
948  '',
949  0,
950  '/^Blanked/'
951  ),
952 
953  array(
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.',
957  'Hello world!',
958  0,
959  '/^Replaced .*Hello/'
960  ),
961 
962  array(
963  'foo',
964  'bar',
965  0,
966  '/^$/'
967  ),
968  );
969  }
970 
975  public function testGetAutosummary( $old, $new, $flags, $expected ) {
976  $this->hideDeprecated( "WikiPage::getAutosummary" );
977 
978  $page = $this->newPage( "WikiPageTest_testGetAutosummary" );
979 
980  $summary = $page->getAutosummary( $old, $new, $flags );
981 
982  $this->assertTrue( (bool)preg_match( $expected, $summary ),
983  "Autosummary didn't match expected pattern $expected: $summary" );
984  }
985 
986  public static function provideGetAutoDeleteReason() {
987  return array(
988  array(
989  array(),
990  false,
991  false
992  ),
993 
994  array(
995  array(
996  array( "first edit", null ),
997  ),
998  "/first edit.*only contributor/",
999  false
1000  ),
1001 
1002  array(
1003  array(
1004  array( "first edit", null ),
1005  array( "second edit", null ),
1006  ),
1007  "/second edit.*only contributor/",
1008  true
1009  ),
1010 
1011  array(
1012  array(
1013  array( "first edit", "127.0.2.22" ),
1014  array( "second edit", "127.0.3.33" ),
1015  ),
1016  "/second edit/",
1017  true
1018  ),
1019 
1020  array(
1021  array(
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 ),
1027  ),
1028  '/first edit:.*\.\.\."/',
1029  false
1030  ),
1031 
1032  array(
1033  array(
1034  array( "first edit", "127.0.2.22" ),
1035  array( "", "127.0.3.33" ),
1036  ),
1037  "/before blanking.*first edit/",
1038  true
1039  ),
1040 
1041  );
1042  }
1043 
1048  public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) {
1049  global $wgUser;
1050 
1051  //NOTE: assume Help namespace to contain wikitext
1052  $page = $this->newPage( "Help:WikiPageTest_testGetAutoDeleteReason" );
1053 
1054  $c = 1;
1055 
1056  foreach ( $edits as $edit ) {
1057  $user = new User();
1058 
1059  if ( !empty( $edit[1] ) ) {
1060  $user->setName( $edit[1] );
1061  } else {
1062  $user = $wgUser;
1063  }
1064 
1065  $content = ContentHandler::makeContent( $edit[0], $page->getTitle(), $page->getContentModel() );
1066 
1067  $page->doEditContent( $content, "test edit $c", $c < 2 ? EDIT_NEW : 0, false, $user );
1068 
1069  $c += 1;
1070  }
1071 
1072  $reason = $page->getAutoDeleteReason( $hasHistory );
1073 
1074  if ( is_bool( $expectedResult ) || is_null( $expectedResult ) ) {
1075  $this->assertEquals( $expectedResult, $reason );
1076  } else {
1077  $this->assertTrue( (bool)preg_match( $expectedResult, $reason ),
1078  "Autosummary didn't match expected pattern $expectedResult: $reason" );
1079  }
1080 
1081  $this->assertEquals( $expectedHistory, $hasHistory,
1082  "expected \$hasHistory to be " . var_export( $expectedHistory, true ) );
1083 
1084  $page->doDeleteArticle( "done" );
1085  }
1086 
1087  public static function providePreSaveTransform() {
1088  return array(
1089  array( 'hello this is ~~~',
1090  "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
1091  ),
1092  array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
1093  'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
1094  ),
1095  );
1096  }
1097 
1102  public function testPreSaveTransform( $text, $expected ) {
1103  $this->hideDeprecated( 'WikiPage::preSaveTransform' );
1104  $user = new User();
1105  $user->setName( "127.0.0.1" );
1106 
1107  //NOTE: assume Help namespace to contain wikitext
1108  $page = $this->newPage( "Help:WikiPageTest_testPreloadTransform" );
1109  $text = $page->preSaveTransform( $text, $user );
1110 
1111  $this->assertEquals( $expected, $text );
1112  }
1113 
1117  public function testWikiPageFactory() {
1118  $title = Title::makeTitle( NS_FILE, 'Someimage.png' );
1119  $page = WikiPage::factory( $title );
1120  $this->assertEquals( 'WikiFilePage', get_class( $page ) );
1121 
1122  $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' );
1123  $page = WikiPage::factory( $title );
1124  $this->assertEquals( 'WikiCategoryPage', get_class( $page ) );
1125 
1126  $title = Title::makeTitle( NS_MAIN, 'SomePage' );
1127  $page = WikiPage::factory( $title );
1128  $this->assertEquals( 'WikiPage', get_class( $page ) );
1129  }
1130 }
WikiPageTest\testGetContent
testGetContent()
@covers WikiPage::getContent
Definition: WikiPageTest.php:310
$wgUser
$wgUser
Definition: Setup.php:552
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
WikiPageTest\testHasViewableContent
testHasViewableContent( $title, $viewable, $create=false)
@dataProvider provideHasViewableContent @covers WikiPage::hasViewableContent
Definition: WikiPageTest.php:427
WikiPageTest\__construct
__construct( $name=null, array $data=array(), $dataName='')
Definition: WikiPageTest.php:13
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
WikiPageTest\testGetParserOutput
testGetParserOutput( $model, $text, $expectedHtml)
@dataProvider provideGetParserOutput @covers WikiPage::getParserOutput
Definition: WikiPageTest.php:620
WikiPageTest\testGetContentHandler
testGetContentHandler()
@covers WikiPage::getContentHandler
Definition: WikiPageTest.php:378
WikiPageTest\tearDown
tearDown()
Definition: WikiPageTest.php:42
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
WikiPageTest\createPage
createPage( $page, $text, $model=null)
Definition: WikiPageTest.php:82
wfGetDB
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:3650
WikiPageTest\testGetRedirectTarget
testGetRedirectTarget( $title, $model, $text, $target)
@dataProvider provideGetRedirectTarget @covers WikiPage::getRedirectTarget
Definition: WikiPageTest.php:451
$n
$n
Definition: RandomTest.php:76
WikiPageTest\testGetContentModel
testGetContentModel()
@covers WikiPage::getContentModel
Definition: WikiPageTest.php:362
WikiPage
Class representing a MediaWiki article and history.
Definition: WikiPage.php:37
WikiPageTest\setUp
setUp()
Definition: WikiPageTest.php:35
WikiPageTest\testIsRedirect
testIsRedirect( $title, $model, $text, $target)
@dataProvider provideGetRedirectTarget @covers WikiPage::isRedirect
Definition: WikiPageTest.php:467
WikiPageTest\testDoRollback
testDoRollback()
Definition: WikiPageTest.php:855
CONTENT_MODEL_WIKITEXT
const CONTENT_MODEL_WIKITEXT
Definition: Defines.php:283
WikiPageTest\testDoDeleteUpdates
testDoDeleteUpdates()
@covers WikiPage::doDeleteUpdates
Definition: WikiPageTest.php:274
$dbr
$dbr
Definition: testCompression.php:48
WikiPageTest\testDoDeleteArticle
testDoDeleteArticle()
@covers WikiPage::doDeleteArticle
Definition: WikiPageTest.php:247
WikiPageTest\$pages_to_delete
$pages_to_delete
Definition: WikiPageTest.php:11
ContentHandler\getDefaultModelFor
static getDefaultModelFor(Title $title)
Returns the name of the default content model to be used for the page with the given title.
Definition: ContentHandler.php:193
WikiCategoryPage
Special handling for category pages.
Definition: WikiCategoryPage.php:26
MWException
MediaWiki exception.
Definition: MWException.php:26
WikiPage\doDeleteArticle
doDeleteArticle( $reason, $suppress=false, $id=0, $commit=true, &$error='', User $user=null)
Same as doDeleteArticleReal(), but returns a simple boolean.
Definition: WikiPage.php:2664
there
has been added to your &Future changes to this page and its associated Talk page will be listed there
Definition: All_system_messages.txt:357
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Definition: MediaWikiTestCase.php:302
WikiPageTest\testExists
testExists()
@covers WikiPage::exists
Definition: WikiPageTest.php:394
MediaWikiTestCase\hideDeprecated
hideDeprecated( $function)
Don't throw a warning if $function is deprecated and called later.
Definition: MediaWikiTestCase.php:679
WikiPageTest\testDoQuickEdit
testDoQuickEdit()
@covers WikiPage::doQuickEdit
Definition: WikiPageTest.php:212
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
WikiPageTest\provideIsCountable
static provideIsCountable()
Definition: WikiPageTest.php:472
MediaWikiTestCase\getDefaultWikitextNS
getDefaultWikitextNS()
Returns the ID of a namespace that defaults to Wikitext.
Definition: MediaWikiTestCase.php:903
WikiPageTest\provideGetRedirectTarget
static provideGetRedirectTarget()
Definition: WikiPageTest.php:440
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
WikiPageTest
@group ContentHandler @group Database ^— important, causes temporary tables to be used instead of the...
Definition: WikiPageTest.php:9
ContentHandler\makeContent
static makeContent( $text, Title $title=null, $modelId=null, $format=null)
Convenience function for creating a Content object from a given textual representation.
Definition: ContentHandler.php:144
WikiPageTest\testIsCountable
testIsCountable( $title, $model, $text, $mode, $expected)
@dataProvider provideIsCountable @covers WikiPage::isCountable
Definition: WikiPageTest.php:583
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
WikiPageTest\newPage
newPage( $title, $model=null)
Definition: WikiPageTest.php:62
etc
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add etc
Definition: design.txt:12
MediaWikiLangTestCase
Base class that store and restore the Language objects.
Definition: MediaWikiLangTestCase.php:6
WikiPageTest\testDoQuickEditContent
testDoQuickEditContent()
@covers WikiPage::doQuickEditContent
Definition: WikiPageTest.php:231
WikiPageTest\provideHasViewableContent
static provideHasViewableContent()
Definition: WikiPageTest.php:413
only
published in in Madrid In the first edition of the Vocabolario for was published In in Rotterdam was the Dictionnaire Universel ! html< p > The first monolingual dictionary written in a Romance language was< i > Sebastián Covarrubias</i >< i > Tesoro de la lengua castellana o published in in Madrid In the first edition of the< i > Vocabolario dell< a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)"> Accademia della Crusca</a ></i > for was published In in Rotterdam was the< i > Dictionnaire Universel</i ></p > ! end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html php< p >< i > foo</i ></p > ! html parsoid< p >< i > foo</i >< b ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i > foo</i ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html< p >< b > foo</b ></p > !end ! test Italics and ! wikitext foo ! html php< p >< b > foo</b ></p > ! html parsoid< p >< b > foo</b >< i ></i ></p > !end ! test Italics and ! options ! wikitext foo ! html< p >< b >< i > foo</i ></b ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo ! html< p >< i >< b > foo</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html< p >< i > foo< b > bar</b ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< i ></i ></p > !end ! test Italics and ! wikitext foo bar ! html php< p >< b > foo</b > bar</p > ! html parsoid< p >< b > foo</b > bar< b ></b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s family</b ></i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< i > this is about< b > foo s</b > family</i ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo</i ></b >< i > s family</i ></p > !end ! test Italics and ! options ! wikitext this is about foo s family ! html< p >< i > this is about</i > foo< b > s family</b ></p > !end ! test Italics and ! wikitext this is about foo s family ! html< p >< b > this is about< i > foo s</i > family</b ></p > !end ! test Italicized possessive ! wikitext The s talk page ! html< p > The< i >< a href="/wiki/Main_Page" title="Main Page"> Main Page</a ></i > s talk page</p > ! end ! test Parsoid only
Definition: parserTests.txt:396
$summary
$summary
Definition: importImages.php:120
EDIT_NEW
const EDIT_NEW
Definition: Defines.php:189
$rev
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
Definition: hooks.txt:1337
DB_SLAVE
const DB_SLAVE
Definition: Defines.php:55
Title
Represents a title within MediaWiki.
Definition: Title.php:35
WikiPageTest\provideGetParserOutput
static provideGetParserOutput()
Definition: WikiPageTest.php:609
WikiPageTest\testDoEdit
testDoEdit()
@covers WikiPage::doEdit
Definition: WikiPageTest.php:152
WikiPageTest\testDoEditContent
testDoEditContent()
@covers WikiPage::doEditContent
Definition: WikiPageTest.php:96
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
WikiPageTest\testGetText
testGetText()
@covers WikiPage::getText
Definition: WikiPageTest.php:326
WikiFilePage
Special handling for file pages.
Definition: WikiFilePage.php:28
CONTENT_MODEL_JAVASCRIPT
const CONTENT_MODEL_JAVASCRIPT
Definition: Defines.php:284
$t
$t
Definition: testCompression.php:65
WikiPage\preSaveTransform
preSaveTransform( $text, User $user=null, ParserOptions $popts=null)
This function is called right before saving the wikitext, so we can do things like signatures and lin...
Definition: WikiPage.php:3393
WikiPageTest\testGetRevision
testGetRevision()
@covers WikiPage::getRevision
Definition: WikiPageTest.php:292
$res
$res
Definition: database.txt:21
LinkCache\singleton
static & singleton()
Get an instance of this class.
Definition: LinkCache.php:49
redirect
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second redirect
Definition: All_system_messages.txt:1267
WikiPageTest\testGetRawText
testGetRawText()
@covers WikiPage::getRawText
Definition: WikiPageTest.php:344
page
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values my talk page
Definition: hooks.txt:1956