Revert "Adding sanity check to Title::isRedirect()."
[lhc/web/wiklou.git] / tests / phpunit / includes / WikiPageTest.php
1 <?php
2 /**
3 * @group Database
4 * ^--- important, causes temporary tables to be used instead of the real database
5 **/
6
7 class WikiPageTest extends MediaWikiTestCase {
8
9 var $pages_to_delete;
10
11 function __construct( $name = null, array $data = array(), $dataName = '' ) {
12 parent::__construct( $name, $data, $dataName );
13
14 $this->tablesUsed = array_merge ( $this->tablesUsed,
15 array( 'page',
16 'revision',
17 'text',
18
19 'recentchanges',
20 'logging',
21
22 'page_props',
23 'pagelinks',
24 'categorylinks',
25 'langlinks',
26 'externallinks',
27 'imagelinks',
28 'templatelinks',
29 'iwlinks' ) );
30 }
31
32 public function setUp() {
33 $this->pages_to_delete = array();
34 }
35
36 public function tearDown() {
37 foreach ( $this->pages_to_delete as $p ) {
38 /* @var $p WikiPage */
39
40 try {
41 if ( $p->exists() ) {
42 $p->doDeleteArticle( "testing done." );
43 }
44 } catch ( MWException $ex ) {
45 // fail silently
46 }
47 }
48 }
49
50 protected function newPage( $title ) {
51 if ( is_string( $title ) ) $title = Title::newFromText( $title );
52
53 $p = new WikiPage( $title );
54
55 $this->pages_to_delete[] = $p;
56
57 return $p;
58 }
59
60 protected function createPage( $page, $text, $model = null ) {
61 if ( is_string( $page ) ) $page = Title::newFromText( $page );
62 if ( $page instanceof Title ) $page = $this->newPage( $page );
63
64 $page->doEdit( $text, "testing", EDIT_NEW );
65
66 return $page;
67 }
68
69 public function testDoEdit() {
70 $title = Title::newFromText( "WikiPageTest_testDoEdit" );
71
72 $page = $this->newPage( $title );
73
74 $text = "[[Lorem ipsum]] dolor sit amet, consetetur sadipscing elitr, sed diam "
75 . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.";
76
77 $page->doEdit( $text, "testing 1" );
78
79 $this->assertTrue( $title->exists(), "Title object should indicate that the page now exists" );
80 $this->assertTrue( $page->exists(), "WikiPage object should indicate that the page now exists" );
81
82 $id = $page->getId();
83
84 # ------------------------
85 $page = new WikiPage( $title );
86
87 $retrieved = $page->getText();
88 $this->assertEquals( $text, $retrieved, 'retrieved text doesn\'t equal original' );
89
90 # ------------------------
91 $text = "At vero eos et accusam et justo duo [[dolores]] et ea rebum. "
92 . "Stet clita kasd [[gubergren]], no sea takimata sanctus est.";
93
94 $page->doEdit( $text, "testing 2" );
95
96 # ------------------------
97 $page = new WikiPage( $title );
98
99 $retrieved = $page->getText();
100 $this->assertEquals( $text, $retrieved, 'retrieved text doesn\'t equal original' );
101
102 # ------------------------
103 $dbr = wfGetDB( DB_SLAVE );
104 $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
105 $n = $res->numRows();
106 $res->free();
107
108 $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' );
109 }
110
111 public function testDoQuickEdit() {
112 global $wgUser;
113
114 $page = $this->createPage( "WikiPageTest_testDoQuickEdit", "original text" );
115
116 $text = "quick text";
117 $page->doQuickEdit( $text, $wgUser, "testing q" );
118
119 # ---------------------
120 $page = new WikiPage( $page->getTitle() );
121 $this->assertEquals( $text, $page->getText() );
122 }
123
124 public function testDoDeleteArticle() {
125 $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo" );
126 $id = $page->getId();
127
128 $page->doDeleteArticle( "testing deletion" );
129
130 $this->assertFalse( $page->exists(), "WikiPage::exists should return false after page was deleted" );
131 $this->assertFalse( $page->getText(), "WikiPage::getText should return false after page was deleted" );
132
133 $t = Title::newFromText( $page->getTitle()->getPrefixedText() );
134 $this->assertFalse( $t->exists(), "Title::exists should return false after page was deleted" );
135
136 # ------------------------
137 $dbr = wfGetDB( DB_SLAVE );
138 $res = $dbr->select( 'pagelinks', '*', array( 'pl_from' => $id ) );
139 $n = $res->numRows();
140 $res->free();
141
142 $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
143 }
144
145 public function testGetRevision() {
146 $page = $this->newPage( "WikiPageTest_testGetRevision" );
147
148 $rev = $page->getRevision();
149 $this->assertNull( $rev );
150
151 # -----------------
152 $this->createPage( $page, "some text" );
153
154 $rev = $page->getRevision();
155
156 $this->assertEquals( $page->getLatest(), $rev->getId() );
157 $this->assertEquals( "some text", $rev->getText() );
158 }
159
160 public function testGetText() {
161 $page = $this->newPage( "WikiPageTest_testGetText" );
162
163 $text = $page->getText();
164 $this->assertFalse( $text );
165
166 # -----------------
167 $this->createPage( $page, "some text" );
168
169 $text = $page->getText();
170 $this->assertEquals( "some text", $text );
171 }
172
173 public function testGetRawText() {
174 $page = $this->newPage( "WikiPageTest_testGetRawText" );
175
176 $text = $page->getRawText();
177 $this->assertFalse( $text );
178
179 # -----------------
180 $this->createPage( $page, "some text" );
181
182 $text = $page->getRawText();
183 $this->assertEquals( "some text", $text );
184 }
185
186
187 public function testExists() {
188 $page = $this->newPage( "WikiPageTest_testExists" );
189 $this->assertFalse( $page->exists() );
190
191 # -----------------
192 $this->createPage( $page, "some text" );
193 $this->assertTrue( $page->exists() );
194
195 $page = new WikiPage( $page->getTitle() );
196 $this->assertTrue( $page->exists() );
197
198 # -----------------
199 $page->doDeleteArticle( "done testing" );
200 $this->assertFalse( $page->exists() );
201
202 $page = new WikiPage( $page->getTitle() );
203 $this->assertFalse( $page->exists() );
204 }
205
206 public function dataHasViewableContent() {
207 return array(
208 array( 'WikiPageTest_testHasViewableContent', false, true ),
209 array( 'Special:WikiPageTest_testHasViewableContent', false ),
210 array( 'MediaWiki:WikiPageTest_testHasViewableContent', false ),
211 array( 'Special:Userlogin', true ),
212 array( 'MediaWiki:help', true ),
213 );
214 }
215
216 /**
217 * @dataProvider dataHasViewableContent
218 */
219 public function testHasViewableContent( $title, $viewable, $create = false ) {
220 $page = $this->newPage( $title );
221 $this->assertEquals( $viewable, $page->hasViewableContent() );
222
223 if ( $create ) {
224 $this->createPage( $page, "some text" );
225 $this->assertTrue( $page->hasViewableContent() );
226
227 $page = new WikiPage( $page->getTitle() );
228 $this->assertTrue( $page->hasViewableContent() );
229 }
230 }
231
232 public function dataGetRedirectTarget() {
233 return array(
234 array( 'WikiPageTest_testGetRedirectTarget_1', "hello world", null ),
235 array( 'WikiPageTest_testGetRedirectTarget_2', "#REDIRECT [[hello world]]", "Hello world" ),
236 );
237 }
238
239 /**
240 * @dataProvider dataGetRedirectTarget
241 */
242 public function testGetRedirectTarget( $title, $text, $target ) {
243 $page = $this->createPage( $title, $text );
244
245 # now, test the actual redirect
246 $t = $page->getRedirectTarget();
247 $this->assertEquals( $target, is_null( $t ) ? null : $t->getPrefixedText() );
248 }
249
250 /**
251 * @dataProvider dataGetRedirectTarget
252 */
253 public function testIsRedirect( $title, $text, $target ) {
254 $page = $this->createPage( $title, $text );
255 $this->assertEquals( !is_null( $target ), $page->isRedirect() );
256 }
257
258 public function dataIsCountable() {
259 return array(
260
261 // any
262 array( 'WikiPageTest_testIsCountable',
263 '',
264 'any',
265 true
266 ),
267 array( 'WikiPageTest_testIsCountable',
268 'Foo',
269 'any',
270 true
271 ),
272
273 // comma
274 array( 'WikiPageTest_testIsCountable',
275 'Foo',
276 'comma',
277 false
278 ),
279 array( 'WikiPageTest_testIsCountable',
280 'Foo, bar',
281 'comma',
282 true
283 ),
284
285 // link
286 array( 'WikiPageTest_testIsCountable',
287 'Foo',
288 'link',
289 false
290 ),
291 array( 'WikiPageTest_testIsCountable',
292 'Foo [[bar]]',
293 'link',
294 true
295 ),
296
297 // redirects
298 array( 'WikiPageTest_testIsCountable',
299 '#REDIRECT [[bar]]',
300 'any',
301 false
302 ),
303 array( 'WikiPageTest_testIsCountable',
304 '#REDIRECT [[bar]]',
305 'comma',
306 false
307 ),
308 array( 'WikiPageTest_testIsCountable',
309 '#REDIRECT [[bar]]',
310 'link',
311 false
312 ),
313
314 // not a content namespace
315 array( 'Talk:WikiPageTest_testIsCountable',
316 'Foo',
317 'any',
318 false
319 ),
320 array( 'Talk:WikiPageTest_testIsCountable',
321 'Foo, bar',
322 'comma',
323 false
324 ),
325 array( 'Talk:WikiPageTest_testIsCountable',
326 'Foo [[bar]]',
327 'link',
328 false
329 ),
330
331 // not a content namespace, different model
332 array( 'MediaWiki:WikiPageTest_testIsCountable.js',
333 'Foo',
334 'any',
335 false
336 ),
337 array( 'MediaWiki:WikiPageTest_testIsCountable.js',
338 'Foo, bar',
339 'comma',
340 false
341 ),
342 array( 'MediaWiki:WikiPageTest_testIsCountable.js',
343 'Foo [[bar]]',
344 'link',
345 false
346 ),
347 );
348 }
349
350
351 /**
352 * @dataProvider dataIsCountable
353 */
354 public function testIsCountable( $title, $text, $mode, $expected ) {
355 global $wgArticleCountMethod;
356
357 $old = $wgArticleCountMethod;
358 $wgArticleCountMethod = $mode;
359
360 $page = $this->createPage( $title, $text );
361 $editInfo = $page->prepareTextForEdit( $page->getText() );
362
363 $v = $page->isCountable();
364 $w = $page->isCountable( $editInfo );
365 $wgArticleCountMethod = $old;
366
367 $this->assertEquals( $expected, $v, "isCountable( null ) returned unexpected value " . var_export( $v, true )
368 . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" );
369
370 $this->assertEquals( $expected, $w, "isCountable( \$editInfo ) returned unexpected value " . var_export( $v, true )
371 . " instead of " . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" );
372 }
373
374 public function dataGetParserOutput() {
375 return array(
376 array("hello ''world''\n", "<p>hello <i>world</i></p>"),
377 // @todo: more...?
378 );
379 }
380
381 /**
382 * @dataProvider dataGetParserOutput
383 */
384 public function testGetParserOutput( $text, $expectedHtml ) {
385 $page = $this->createPage( 'WikiPageTest_testGetParserOutput', $text );
386
387 $opt = new ParserOptions();
388 $po = $page->getParserOutput( $opt );
389 $text = $po->getText();
390
391 $text = trim( preg_replace( '/<!--.*?-->/sm', '', $text ) ); # strip injected comments
392 $text = preg_replace( '!\s*(</p>)!sm', '\1', $text ); # don't let tidy confuse us
393
394 $this->assertEquals( $expectedHtml, $text );
395 return $po;
396 }
397
398 static $sections =
399
400 "Intro
401
402 == stuff ==
403 hello world
404
405 == test ==
406 just a test
407
408 == foo ==
409 more stuff
410 ";
411
412
413 public function dataReplaceSection() {
414 return array(
415 array( 'WikiPageTest_testReplaceSection',
416 WikiPageTest::$sections,
417 "0",
418 "No more",
419 null,
420 trim( preg_replace( '/^Intro/sm', 'No more', WikiPageTest::$sections ) )
421 ),
422 array( 'WikiPageTest_testReplaceSection',
423 WikiPageTest::$sections,
424 "",
425 "No more",
426 null,
427 "No more"
428 ),
429 array( 'WikiPageTest_testReplaceSection',
430 WikiPageTest::$sections,
431 "2",
432 "== TEST ==\nmore fun",
433 null,
434 trim( preg_replace( '/^== test ==.*== foo ==/sm', "== TEST ==\nmore fun\n\n== foo ==", WikiPageTest::$sections ) )
435 ),
436 array( 'WikiPageTest_testReplaceSection',
437 WikiPageTest::$sections,
438 "8",
439 "No more",
440 null,
441 trim( WikiPageTest::$sections )
442 ),
443 array( 'WikiPageTest_testReplaceSection',
444 WikiPageTest::$sections,
445 "new",
446 "No more",
447 "New",
448 trim( WikiPageTest::$sections ) . "\n\n== New ==\n\nNo more"
449 ),
450 );
451 }
452
453 /**
454 * @dataProvider dataReplaceSection
455 */
456 public function testReplaceSection( $title, $text, $section, $with, $sectionTitle, $expected ) {
457 $page = $this->createPage( $title, $text );
458 $text = $page->replaceSection( $section, $with, $sectionTitle );
459 $text = trim( $text );
460
461 $this->assertEquals( $expected, $text );
462 }
463
464 /* @FIXME: fix this!
465 public function testGetUndoText() {
466 global $wgDiff3;
467
468 wfSuppressWarnings();
469 $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
470 wfRestoreWarnings();
471
472 if( !$haveDiff3 ) {
473 $this->markTestSkipped( "diff3 not installed or not found" );
474 return;
475 }
476
477 $text = "one";
478 $page = $this->createPage( "WikiPageTest_testGetUndoText", $text );
479 $rev1 = $page->getRevision();
480
481 $text .= "\n\ntwo";
482 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section two");
483 $rev2 = $page->getRevision();
484
485 $text .= "\n\nthree";
486 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section three");
487 $rev3 = $page->getRevision();
488
489 $text .= "\n\nfour";
490 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section four");
491 $rev4 = $page->getRevision();
492
493 $text .= "\n\nfive";
494 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section five");
495 $rev5 = $page->getRevision();
496
497 $text .= "\n\nsix";
498 $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), "adding section six");
499 $rev6 = $page->getRevision();
500
501 $undo6 = $page->getUndoText( $rev6 );
502 if ( $undo6 === false ) $this->fail( "getUndoText failed for rev6" );
503 $this->assertEquals( "one\n\ntwo\n\nthree\n\nfour\n\nfive", $undo6 );
504
505 $undo3 = $page->getUndoText( $rev4, $rev2 );
506 if ( $undo3 === false ) $this->fail( "getUndoText failed for rev4..rev2" );
507 $this->assertEquals( "one\n\ntwo\n\nfive", $undo3 );
508
509 $undo2 = $page->getUndoText( $rev2 );
510 if ( $undo2 === false ) $this->fail( "getUndoText failed for rev2" );
511 $this->assertEquals( "one\n\nfive", $undo2 );
512 }
513 */
514
515 /**
516 * @todo FIXME: this is a better rollback test than the one below, but it keeps failing in jenkins for some reason.
517 */
518 public function broken_testDoRollback() {
519 $admin = new User();
520 $admin->setName("Admin");
521
522 $text = "one";
523 $page = $this->newPage( "WikiPageTest_testDoRollback" );
524 $page->doEdit( $text, "section one", EDIT_NEW, false, $admin );
525
526 $user1 = new User();
527 $user1->setName( "127.0.1.11" );
528 $text .= "\n\ntwo";
529 $page = new WikiPage( $page->getTitle() );
530 $page->doEdit( $text, "adding section two", 0, false, $user1 );
531
532 $user2 = new User();
533 $user2->setName( "127.0.2.13" );
534 $text .= "\n\nthree";
535 $page = new WikiPage( $page->getTitle() );
536 $page->doEdit( $text, "adding section three", 0, false, $user2 );
537
538 # we are having issues with doRollback spuriously failing. apparently the last revision somehow goes missing
539 # or not committed under some circumstances. so, make sure the last revision has the right user name.
540 $dbr = wfGetDB( DB_SLAVE );
541 $this->assertEquals( 3, Revision::countByPageId( $dbr, $page->getId() ) );
542
543 $page = new WikiPage( $page->getTitle() );
544 $rev3 = $page->getRevision();
545 $this->assertEquals( '127.0.2.13', $rev3->getUserText() );
546
547 $rev2 = $rev3->getPrevious();
548 $this->assertEquals( '127.0.1.11', $rev2->getUserText() );
549
550 $rev1 = $rev2->getPrevious();
551 $this->assertEquals( 'Admin', $rev1->getUserText() );
552
553 # now, try the actual rollback
554 $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
555 $token = $admin->getEditToken( array( $page->getTitle()->getPrefixedText(), $user2->getName() ), null );
556 $errors = $page->doRollback( $user2->getName(), "testing revert", $token, false, $details, $admin );
557
558 if ( $errors ) {
559 $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
560 }
561
562 $page = new WikiPage( $page->getTitle() );
563 $this->assertEquals( $rev2->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision" );
564 $this->assertEquals( "one\n\ntwo", $page->getText() );
565 }
566
567 /**
568 * @todo FIXME: the above rollback test is better, but it keeps failing in jenkins for some reason.
569 */
570 public function testDoRollback() {
571 $admin = new User();
572 $admin->setName("Admin");
573
574 $text = "one";
575 $page = $this->newPage( "WikiPageTest_testDoRollback" );
576 $page->doEdit( $text, "section one", EDIT_NEW, false, $admin );
577 $rev1 = $page->getRevision();
578
579 $user1 = new User();
580 $user1->setName( "127.0.1.11" );
581 $text .= "\n\ntwo";
582 $page = new WikiPage( $page->getTitle() );
583 $page->doEdit( $text, "adding section two", 0, false, $user1 );
584
585 # now, try the rollback
586 $admin->addGroup( "sysop" ); #XXX: make the test user a sysop...
587 $token = $admin->getEditToken( array( $page->getTitle()->getPrefixedText(), $user1->getName() ), null );
588 $errors = $page->doRollback( $user1->getName(), "testing revert", $token, false, $details, $admin );
589
590 if ( $errors ) {
591 $this->fail( "Rollback failed:\n" . print_r( $errors, true ) . ";\n" . print_r( $details, true ) );
592 }
593
594 $page = new WikiPage( $page->getTitle() );
595 $this->assertEquals( $rev1->getSha1(), $page->getRevision()->getSha1(), "rollback did not revert to the correct revision" );
596 $this->assertEquals( "one", $page->getText() );
597 }
598
599 public function dataGetAutosummary( ) {
600 return array(
601 array(
602 'Hello there, world!',
603 '#REDIRECT [[Foo]]',
604 0,
605 '/^Redirected page .*Foo/'
606 ),
607
608 array(
609 null,
610 'Hello world!',
611 EDIT_NEW,
612 '/^Created page .*Hello/'
613 ),
614
615 array(
616 'Hello there, world!',
617 '',
618 0,
619 '/^Blanked/'
620 ),
621
622 array(
623 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
624 labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et
625 ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.',
626 'Hello world!',
627 0,
628 '/^Replaced .*Hello/'
629 ),
630
631 array(
632 'foo',
633 'bar',
634 0,
635 '/^$/'
636 ),
637 );
638 }
639
640 /**
641 * @dataProvider dataGetAutoSummary
642 */
643 public function testGetAutosummary( $old, $new, $flags, $expected ) {
644 $page = $this->newPage( "WikiPageTest_testGetAutosummary" );
645
646 $summary = $page->getAutosummary( $old, $new, $flags );
647
648 $this->assertTrue( (bool)preg_match( $expected, $summary ), "Autosummary didn't match expected pattern $expected: $summary" );
649 }
650
651 public function dataGetAutoDeleteReason( ) {
652 return array(
653 array(
654 array(),
655 false,
656 false
657 ),
658
659 array(
660 array(
661 array( "first edit", null ),
662 ),
663 "/first edit.*only contributor/",
664 false
665 ),
666
667 array(
668 array(
669 array( "first edit", null ),
670 array( "second edit", null ),
671 ),
672 "/second edit.*only contributor/",
673 true
674 ),
675
676 array(
677 array(
678 array( "first edit", "127.0.2.22" ),
679 array( "second edit", "127.0.3.33" ),
680 ),
681 "/second edit/",
682 true
683 ),
684
685 array(
686 array(
687 array( "first edit: "
688 . "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam "
689 . " nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. "
690 . "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea "
691 . "takimata sanctus est Lorem ipsum dolor sit amet.'", null ),
692 ),
693 '/first edit:.*\.\.\."/',
694 false
695 ),
696
697 array(
698 array(
699 array( "first edit", "127.0.2.22" ),
700 array( "", "127.0.3.33" ),
701 ),
702 "/before blanking.*first edit/",
703 true
704 ),
705
706 );
707 }
708
709 /**
710 * @dataProvider dataGetAutoDeleteReason
711 */
712 public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) {
713 global $wgUser;
714
715 $page = $this->newPage( "WikiPageTest_testGetAutoDeleteReason" );
716
717 $c = 1;
718
719 foreach ( $edits as $edit ) {
720 $user = new User();
721
722 if ( !empty( $edit[1] ) ) $user->setName( $edit[1] );
723 else $user = $wgUser;
724
725 $page->doEdit( $edit[0], "test edit $c", $c < 2 ? EDIT_NEW : 0, false, $user );
726
727 $c += 1;
728 }
729
730 $reason = $page->getAutoDeleteReason( $hasHistory );
731
732 if ( is_bool( $expectedResult ) || is_null( $expectedResult ) ) $this->assertEquals( $expectedResult, $reason );
733 else $this->assertTrue( (bool)preg_match( $expectedResult, $reason ), "Autosummary didn't match expected pattern $expectedResult: $reason" );
734
735 $this->assertEquals( $expectedHistory, $hasHistory, "expected \$hasHistory to be " . var_export( $expectedHistory, true ) );
736
737 $page->doDeleteArticle( "done" );
738 }
739
740 public function dataPreSaveTransform() {
741 return array(
742 array( 'hello this is ~~~',
743 "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
744 ),
745 array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
746 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
747 ),
748 );
749 }
750
751 /**
752 * @dataProvider dataPreSaveTransform
753 */
754 public function testPreSaveTransform( $text, $expected ) {
755 $user = new User();
756 $user->setName("127.0.0.1");
757
758 $page = $this->newPage( "WikiPageTest_testPreloadTransform" );
759 $text = $page->preSaveTransform( $text, $user );
760
761 $this->assertEquals( $expected, $text );
762 }
763
764 }
765