4 * @group ContentHandler
9 class RevisionIntegrationTest
extends MediaWikiTestCase
{
12 * @var WikiPage $testPage
16 public function __construct( $name = null, array $data = [], $dataName = '' ) {
17 parent
::__construct( $name, $data, $dataName );
19 $this->tablesUsed
= array_merge( $this->tablesUsed
,
42 protected function setUp() {
47 $this->mergeMwGlobalArrayValue(
51 12313 => 'Dummy_talk',
55 $this->mergeMwGlobalArrayValue(
56 'wgNamespaceContentModels',
58 12312 => DummyContentForTesting
::MODEL_ID
,
62 $this->mergeMwGlobalArrayValue(
65 DummyContentForTesting
::MODEL_ID
=> 'DummyContentHandlerForTesting',
66 RevisionTestModifyableContent
::MODEL_ID
=> 'RevisionTestModifyableContentHandler',
70 MWNamespace
::clearCaches();
71 // Reset namespace cache
72 $wgContLang->resetNamespaces();
73 if ( !$this->testPage
) {
74 $this->testPage
= WikiPage
::factory( Title
::newFromText( 'UTPage' ) );
78 protected function tearDown() {
83 MWNamespace
::clearCaches();
84 // Reset namespace cache
85 $wgContLang->resetNamespaces();
88 private function makeRevisionWithProps( $props = null ) {
89 if ( $props === null ) {
93 if ( !isset( $props['content'] ) && !isset( $props['text'] ) ) {
94 $props['text'] = 'Lorem Ipsum';
97 if ( !isset( $props['comment'] ) ) {
98 $props['comment'] = 'just a test';
101 if ( !isset( $props['page'] ) ) {
102 $props['page'] = $this->testPage
->getId();
105 $rev = new Revision( $props );
107 $dbw = wfGetDB( DB_MASTER
);
108 $rev->insertOn( $dbw );
114 * @param string $titleString
115 * @param string $text
116 * @param string|null $model
120 private function createPage( $titleString, $text, $model = null ) {
121 if ( !preg_match( '/:/', $titleString ) &&
122 ( $model === null ||
$model === CONTENT_MODEL_WIKITEXT
)
124 $ns = $this->getDefaultWikitextNS();
125 $titleString = MWNamespace
::getCanonicalName( $ns ) . ':' . $titleString;
128 $title = Title
::newFromText( $titleString );
129 $wikipage = new WikiPage( $title );
131 // Delete the article if it already exists
132 if ( $wikipage->exists() ) {
133 $wikipage->doDeleteArticle( "done" );
136 $content = ContentHandler
::makeContent( $text, $title, $model );
137 $wikipage->doEditContent( $content, __METHOD__
, EDIT_NEW
);
142 private function assertRevEquals( Revision
$orig, Revision
$rev = null ) {
143 $this->assertNotNull( $rev, 'missing revision' );
145 $this->assertEquals( $orig->getId(), $rev->getId() );
146 $this->assertEquals( $orig->getPage(), $rev->getPage() );
147 $this->assertEquals( $orig->getTimestamp(), $rev->getTimestamp() );
148 $this->assertEquals( $orig->getUser(), $rev->getUser() );
149 $this->assertEquals( $orig->getContentModel(), $rev->getContentModel() );
150 $this->assertEquals( $orig->getContentFormat(), $rev->getContentFormat() );
151 $this->assertEquals( $orig->getSha1(), $rev->getSha1() );
155 * @covers Revision::__construct
157 public function testConstructFromRow() {
158 $latestRevisionId = $this->testPage
->getLatest();
159 $latestRevision = $this->testPage
->getRevision();
161 $dbr = wfGetDB( DB_REPLICA
);
164 Revision
::selectFields(),
165 [ 'rev_id' => $latestRevisionId ]
167 $this->assertTrue( is_object( $res ), 'query failed' );
169 $row = $res->fetchObject();
172 $this->assertRevEquals( $latestRevision, new Revision( $row ) );
176 * @covers Revision::newFromTitle
178 public function testNewFromTitle_withoutId() {
179 $latestRevId = $this->testPage
->getLatest();
181 $rev = Revision
::newFromTitle( $this->testPage
->getTitle() );
183 $this->assertTrue( $this->testPage
->getTitle()->equals( $rev->getTitle() ) );
184 $this->assertEquals( $latestRevId, $rev->getId() );
188 * @covers Revision::newFromTitle
190 public function testNewFromTitle_withId() {
191 $latestRevId = $this->testPage
->getLatest();
193 $rev = Revision
::newFromTitle( $this->testPage
->getTitle(), $latestRevId );
195 $this->assertTrue( $this->testPage
->getTitle()->equals( $rev->getTitle() ) );
196 $this->assertEquals( $latestRevId, $rev->getId() );
200 * @covers Revision::newFromTitle
202 public function testNewFromTitle_withBadId() {
203 $latestRevId = $this->testPage
->getLatest();
205 $rev = Revision
::newFromTitle( $this->testPage
->getTitle(), $latestRevId +
1 );
207 $this->assertNull( $rev );
211 * @covers Revision::newFromRow
213 public function testNewFromRow() {
214 $orig = $this->makeRevisionWithProps();
216 $dbr = wfGetDB( DB_REPLICA
);
217 $res = $dbr->select( 'revision', Revision
::selectFields(), [ 'rev_id' => $orig->getId() ] );
218 $this->assertTrue( is_object( $res ), 'query failed' );
220 $row = $res->fetchObject();
223 $rev = Revision
::newFromRow( $row );
225 $this->assertRevEquals( $orig, $rev );
228 public function provideTrueFalse() {
234 * @dataProvider provideTrueFalse
235 * @covers Revision::newFromArchiveRow
237 public function testNewFromArchiveRow( $contentHandlerUseDB ) {
238 $this->setMwGlobals( 'wgContentHandlerUseDB', $contentHandlerUseDB );
240 $page = $this->createPage(
241 'RevisionStorageTest_testNewFromArchiveRow',
243 CONTENT_MODEL_WIKITEXT
245 $orig = $page->getRevision();
246 $page->doDeleteArticle( 'test Revision::newFromArchiveRow' );
248 $dbr = wfGetDB( DB_REPLICA
);
250 'archive', Revision
::selectArchiveFields(), [ 'ar_rev_id' => $orig->getId() ]
252 $this->assertTrue( is_object( $res ), 'query failed' );
254 $row = $res->fetchObject();
257 $rev = Revision
::newFromArchiveRow( $row );
259 $this->assertRevEquals( $orig, $rev );
263 * @covers Revision::newFromId
265 public function testNewFromId() {
266 $orig = $this->testPage
->getRevision();
267 $rev = Revision
::newFromId( $orig->getId() );
268 $this->assertRevEquals( $orig, $rev );
272 * @covers Revision::newFromPageId
274 public function testNewFromPageId() {
275 $rev = Revision
::newFromPageId( $this->testPage
->getId() );
276 $this->assertRevEquals(
277 $this->testPage
->getRevision(),
283 * @covers Revision::newFromPageId
285 public function testNewFromPageIdWithLatestId() {
286 $rev = Revision
::newFromPageId(
287 $this->testPage
->getId(),
288 $this->testPage
->getLatest()
290 $this->assertRevEquals(
291 $this->testPage
->getRevision(),
297 * @covers Revision::newFromPageId
299 public function testNewFromPageIdWithNotLatestId() {
300 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
301 $rev = Revision
::newFromPageId(
302 $this->testPage
->getId(),
303 $this->testPage
->getRevision()->getPrevious()->getId()
305 $this->assertRevEquals(
306 $this->testPage
->getRevision()->getPrevious(),
312 * @covers Revision::fetchRevision
314 public function testFetchRevision() {
315 // Hidden process cache assertion below
316 $this->testPage
->getRevision()->getId();
318 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
319 $id = $this->testPage
->getRevision()->getId();
321 $res = Revision
::fetchRevision( $this->testPage
->getTitle() );
323 # note: order is unspecified
325 while ( ( $row = $res->fetchObject() ) ) {
326 $rows[$row->rev_id
] = $row;
329 $this->assertEquals( 1, count( $rows ), 'expected exactly one revision' );
330 $this->assertArrayHasKey( $id, $rows, 'missing revision with id ' . $id );
334 * @covers Revision::selectFields
336 public function testSelectFields() {
337 global $wgContentHandlerUseDB;
339 $fields = Revision
::selectFields();
341 $this->assertTrue( in_array( 'rev_id', $fields ), 'missing rev_id in list of fields' );
342 $this->assertTrue( in_array( 'rev_page', $fields ), 'missing rev_page in list of fields' );
344 in_array( 'rev_timestamp', $fields ),
345 'missing rev_timestamp in list of fields'
347 $this->assertTrue( in_array( 'rev_user', $fields ), 'missing rev_user in list of fields' );
349 if ( $wgContentHandlerUseDB ) {
350 $this->assertTrue( in_array( 'rev_content_model', $fields ),
351 'missing rev_content_model in list of fields' );
352 $this->assertTrue( in_array( 'rev_content_format', $fields ),
353 'missing rev_content_format in list of fields' );
358 * @covers Revision::getPage
360 public function testGetPage() {
361 $page = $this->testPage
;
363 $orig = $this->makeRevisionWithProps( [ 'page' => $page->getId() ] );
364 $rev = Revision
::newFromId( $orig->getId() );
366 $this->assertEquals( $page->getId(), $rev->getPage() );
370 * @covers Revision::isCurrent
372 public function testIsCurrent() {
373 $rev1 = $this->testPage
->getRevision();
375 # @todo find out if this should be true
376 # $this->assertTrue( $rev1->isCurrent() );
378 $rev1x = Revision
::newFromId( $rev1->getId() );
379 $this->assertTrue( $rev1x->isCurrent() );
381 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
382 $rev2 = $this->testPage
->getRevision();
384 # @todo find out if this should be true
385 # $this->assertTrue( $rev2->isCurrent() );
387 $rev1x = Revision
::newFromId( $rev1->getId() );
388 $this->assertFalse( $rev1x->isCurrent() );
390 $rev2x = Revision
::newFromId( $rev2->getId() );
391 $this->assertTrue( $rev2x->isCurrent() );
395 * @covers Revision::getPrevious
397 public function testGetPrevious() {
398 $oldestRevision = $this->testPage
->getOldestRevision();
399 $latestRevision = $this->testPage
->getLatest();
401 $this->assertNull( $oldestRevision->getPrevious() );
403 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
404 $newRevision = $this->testPage
->getRevision();
406 $this->assertNotNull( $newRevision->getPrevious() );
407 $this->assertEquals( $latestRevision, $newRevision->getPrevious()->getId() );
411 * @covers Revision::getNext
413 public function testGetNext() {
414 $rev1 = $this->testPage
->getRevision();
416 $this->assertNull( $rev1->getNext() );
418 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
419 $rev2 = $this->testPage
->getRevision();
421 $this->assertNotNull( $rev1->getNext() );
422 $this->assertEquals( $rev2->getId(), $rev1->getNext()->getId() );
426 * @covers Revision::newNullRevision
428 public function testNewNullRevision() {
429 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
430 $orig = $this->testPage
->getRevision();
432 $dbw = wfGetDB( DB_MASTER
);
433 $rev = Revision
::newNullRevision( $dbw, $this->testPage
->getId(), 'a null revision', false );
435 $this->assertNotEquals( $orig->getId(), $rev->getId(),
436 'new null revision should have a different id from the original revision' );
437 $this->assertEquals( $orig->getTextId(), $rev->getTextId(),
438 'new null revision should have the same text id as the original revision' );
439 $this->assertEquals( __METHOD__
, $rev->getContent()->getNativeData() );
443 * @covers Revision::insertOn
445 public function testInsertOn() {
446 $ip = '2600:387:ed7:947e:8c16:a1ad:dd34:1dd7';
448 $orig = $this->makeRevisionWithProps( [
452 // Make sure the revision was copied to ip_changes
453 $dbr = wfGetDB( DB_REPLICA
);
454 $res = $dbr->select( 'ip_changes', '*', [ 'ipc_rev_id' => $orig->getId() ] );
455 $row = $res->fetchObject();
457 $this->assertEquals( IP
::toHex( $ip ), $row->ipc_hex
);
458 $this->assertEquals( $orig->getTimestamp(), $row->ipc_rev_timestamp
);
461 public static function provideUserWasLastToEdit() {
462 yield
'actually the last edit' => [ 3, true ];
463 yield
'not the current edit, but still by this user' => [ 2, true ];
464 yield
'edit by another user' => [ 1, false ];
465 yield
'first edit, by this user, but another user edited in the mean time' => [ 0, false ];
469 * @dataProvider provideUserWasLastToEdit
471 public function testUserWasLastToEdit( $sinceIdx, $expectedLast ) {
472 $userA = User
::newFromName( "RevisionStorageTest_userA" );
473 $userB = User
::newFromName( "RevisionStorageTest_userB" );
475 if ( $userA->getId() === 0 ) {
476 $userA = User
::createNew( $userA->getName() );
479 if ( $userB->getId() === 0 ) {
480 $userB = User
::createNew( $userB->getName() );
483 $ns = $this->getDefaultWikitextNS();
485 $dbw = wfGetDB( DB_MASTER
);
488 // create revisions -----------------------------
489 $page = WikiPage
::factory( Title
::newFromText(
490 'RevisionStorageTest_testUserWasLastToEdit', $ns ) );
491 $page->insertOn( $dbw );
493 $revisions[0] = new Revision( [
494 'page' => $page->getId(),
495 // we need the title to determine the page's default content model
496 'title' => $page->getTitle(),
497 'timestamp' => '20120101000000',
498 'user' => $userA->getId(),
500 'content_model' => CONTENT_MODEL_WIKITEXT
,
501 'summary' => 'edit zero'
503 $revisions[0]->insertOn( $dbw );
505 $revisions[1] = new Revision( [
506 'page' => $page->getId(),
507 // still need the title, because $page->getId() is 0 (there's no entry in the page table)
508 'title' => $page->getTitle(),
509 'timestamp' => '20120101000100',
510 'user' => $userA->getId(),
512 'content_model' => CONTENT_MODEL_WIKITEXT
,
513 'summary' => 'edit one'
515 $revisions[1]->insertOn( $dbw );
517 $revisions[2] = new Revision( [
518 'page' => $page->getId(),
519 'title' => $page->getTitle(),
520 'timestamp' => '20120101000200',
521 'user' => $userB->getId(),
523 'content_model' => CONTENT_MODEL_WIKITEXT
,
524 'summary' => 'edit two'
526 $revisions[2]->insertOn( $dbw );
528 $revisions[3] = new Revision( [
529 'page' => $page->getId(),
530 'title' => $page->getTitle(),
531 'timestamp' => '20120101000300',
532 'user' => $userA->getId(),
534 'content_model' => CONTENT_MODEL_WIKITEXT
,
535 'summary' => 'edit three'
537 $revisions[3]->insertOn( $dbw );
539 $revisions[4] = new Revision( [
540 'page' => $page->getId(),
541 'title' => $page->getTitle(),
542 'timestamp' => '20120101000200',
543 'user' => $userA->getId(),
545 'content_model' => CONTENT_MODEL_WIKITEXT
,
546 'summary' => 'edit four'
548 $revisions[4]->insertOn( $dbw );
550 // test it ---------------------------------
551 $since = $revisions[$sinceIdx]->getTimestamp();
553 $wasLast = Revision
::userWasLastToEdit( $dbw, $page->getId(), $userA->getId(), $since );
555 $this->assertEquals( $expectedLast, $wasLast );
559 * @param string $text
560 * @param string $title
561 * @param string $model
562 * @param string $format
566 private function newTestRevision( $text, $title = "Test",
567 $model = CONTENT_MODEL_WIKITEXT
, $format = null
569 if ( is_string( $title ) ) {
570 $title = Title
::newFromText( $title );
573 $content = ContentHandler
::makeContent( $text, $title, $model, $format );
581 'content' => $content,
582 'length' => $content->getSize(),
583 'comment' => "testing",
584 'minor_edit' => false,
586 'content_format' => $format,
593 public function provideGetContentModel() {
594 // NOTE: we expect the help namespace to always contain wikitext
596 [ 'hello world', 'Help:Hello', null, null, CONTENT_MODEL_WIKITEXT
],
597 [ 'hello world', 'User:hello/there.css', null, null, CONTENT_MODEL_CSS
],
598 [ serialize( 'hello world' ), 'Dummy:Hello', null, null, DummyContentForTesting
::MODEL_ID
],
603 * @dataProvider provideGetContentModel
604 * @covers Revision::getContentModel
606 public function testGetContentModel( $text, $title, $model, $format, $expectedModel ) {
607 $rev = $this->newTestRevision( $text, $title, $model, $format );
609 $this->assertEquals( $expectedModel, $rev->getContentModel() );
612 public function provideGetContentFormat() {
613 // NOTE: we expect the help namespace to always contain wikitext
615 [ 'hello world', 'Help:Hello', null, null, CONTENT_FORMAT_WIKITEXT
],
616 [ 'hello world', 'Help:Hello', CONTENT_MODEL_CSS
, null, CONTENT_FORMAT_CSS
],
617 [ 'hello world', 'User:hello/there.css', null, null, CONTENT_FORMAT_CSS
],
618 [ serialize( 'hello world' ), 'Dummy:Hello', null, null, DummyContentForTesting
::MODEL_ID
],
623 * @dataProvider provideGetContentFormat
624 * @covers Revision::getContentFormat
626 public function testGetContentFormat( $text, $title, $model, $format, $expectedFormat ) {
627 $rev = $this->newTestRevision( $text, $title, $model, $format );
629 $this->assertEquals( $expectedFormat, $rev->getContentFormat() );
632 public function provideGetContentHandler() {
633 // NOTE: we expect the help namespace to always contain wikitext
635 [ 'hello world', 'Help:Hello', null, null, 'WikitextContentHandler' ],
636 [ 'hello world', 'User:hello/there.css', null, null, 'CssContentHandler' ],
637 [ serialize( 'hello world' ), 'Dummy:Hello', null, null, 'DummyContentHandlerForTesting' ],
642 * @dataProvider provideGetContentHandler
643 * @covers Revision::getContentHandler
645 public function testGetContentHandler( $text, $title, $model, $format, $expectedClass ) {
646 $rev = $this->newTestRevision( $text, $title, $model, $format );
648 $this->assertEquals( $expectedClass, get_class( $rev->getContentHandler() ) );
651 public function provideGetContent() {
652 // NOTE: we expect the help namespace to always contain wikitext
654 [ 'hello world', 'Help:Hello', null, null, Revision
::FOR_PUBLIC
, 'hello world' ],
656 serialize( 'hello world' ),
658 DummyContentForTesting
::MODEL_ID
,
660 Revision
::FOR_PUBLIC
,
661 serialize( 'hello world' )
664 serialize( 'hello world' ),
668 Revision
::FOR_PUBLIC
,
669 serialize( 'hello world' )
675 * @dataProvider provideGetContent
676 * @covers Revision::getContent
678 public function testGetContent( $text, $title, $model, $format,
679 $audience, $expectedSerialization
681 $rev = $this->newTestRevision( $text, $title, $model, $format );
682 $content = $rev->getContent( $audience );
685 $expectedSerialization,
686 is_null( $content ) ?
null : $content->serialize( $format )
691 * @covers Revision::getContent
693 public function testGetContent_failure() {
694 $rev = new Revision( [
695 'page' => $this->testPage
->getId(),
696 'content_model' => $this->testPage
->getContentModel(),
697 'text_id' => 123456789, // not in the test DB
700 $this->assertNull( $rev->getContent(),
701 "getContent() should return null if the revision's text blob could not be loaded." );
703 // NOTE: check this twice, once for lazy initialization, and once with the cached value.
704 $this->assertNull( $rev->getContent(),
705 "getContent() should return null if the revision's text blob could not be loaded." );
708 public function provideGetSize() {
710 [ "hello world.", CONTENT_MODEL_WIKITEXT
, 12 ],
711 [ serialize( "hello world." ), DummyContentForTesting
::MODEL_ID
, 12 ],
716 * @covers Revision::getSize
717 * @dataProvider provideGetSize
719 public function testGetSize( $text, $model, $expected_size ) {
720 $rev = $this->newTestRevision( $text, 'RevisionTest_testGetSize', $model );
721 $this->assertEquals( $expected_size, $rev->getSize() );
724 public function provideGetSha1() {
726 [ "hello world.", CONTENT_MODEL_WIKITEXT
, Revision
::base36Sha1( "hello world." ) ],
728 serialize( "hello world." ),
729 DummyContentForTesting
::MODEL_ID
,
730 Revision
::base36Sha1( serialize( "hello world." ) )
736 * @covers Revision::getSha1
737 * @dataProvider provideGetSha1
739 public function testGetSha1( $text, $model, $expected_hash ) {
740 $rev = $this->newTestRevision( $text, 'RevisionTest_testGetSha1', $model );
741 $this->assertEquals( $expected_hash, $rev->getSha1() );
745 * Tests whether $rev->getContent() returns a clone when needed.
747 * @covers Revision::getContent
749 public function testGetContentClone() {
750 $content = new RevisionTestModifyableContent( "foo" );
756 'title' => Title
::newFromText( "testGetContentClone_dummy" ),
758 'content' => $content,
759 'length' => $content->getSize(),
760 'comment' => "testing",
761 'minor_edit' => false,
765 /** @var RevisionTestModifyableContent $content */
766 $content = $rev->getContent( Revision
::RAW
);
767 $content->setText( "bar" );
769 /** @var RevisionTestModifyableContent $content2 */
770 $content2 = $rev->getContent( Revision
::RAW
);
771 // content is mutable, expect clone
772 $this->assertNotSame( $content, $content2, "expected a clone" );
773 // clone should contain the original text
774 $this->assertEquals( "foo", $content2->getText() );
776 $content2->setText( "bla bla" );
777 // clones should be independent
778 $this->assertEquals( "bar", $content->getText() );
782 * Tests whether $rev->getContent() returns the same object repeatedly if appropriate.
783 * @covers Revision::getContent
785 public function testGetContentUncloned() {
786 $rev = $this->newTestRevision( "hello", "testGetContentUncloned_dummy", CONTENT_MODEL_WIKITEXT
);
787 $content = $rev->getContent( Revision
::RAW
);
788 $content2 = $rev->getContent( Revision
::RAW
);
790 // for immutable content like wikitext, this should be the same object
791 $this->assertSame( $content, $content2 );
795 * @covers Revision::loadFromId
797 public function testLoadFromId() {
798 $rev = $this->testPage
->getRevision();
799 $this->assertRevEquals(
801 Revision
::loadFromId( wfGetDB( DB_MASTER
), $rev->getId() )
806 * @covers Revision::loadFromPageId
808 public function testLoadFromPageId() {
809 $this->assertRevEquals(
810 $this->testPage
->getRevision(),
811 Revision
::loadFromPageId( wfGetDB( DB_MASTER
), $this->testPage
->getId() )
816 * @covers Revision::loadFromPageId
818 public function testLoadFromPageIdWithLatestRevId() {
819 $this->assertRevEquals(
820 $this->testPage
->getRevision(),
821 Revision
::loadFromPageId(
822 wfGetDB( DB_MASTER
),
823 $this->testPage
->getId(),
824 $this->testPage
->getLatest()
830 * @covers Revision::loadFromPageId
832 public function testLoadFromPageIdWithNotLatestRevId() {
833 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
834 $this->assertRevEquals(
835 $this->testPage
->getRevision()->getPrevious(),
836 Revision
::loadFromPageId(
837 wfGetDB( DB_MASTER
),
838 $this->testPage
->getId(),
839 $this->testPage
->getRevision()->getPrevious()->getId()
845 * @covers Revision::loadFromTitle
847 public function testLoadFromTitle() {
848 $this->assertRevEquals(
849 $this->testPage
->getRevision(),
850 Revision
::loadFromTitle( wfGetDB( DB_MASTER
), $this->testPage
->getTitle() )
855 * @covers Revision::loadFromTitle
857 public function testLoadFromTitleWithLatestRevId() {
858 $this->assertRevEquals(
859 $this->testPage
->getRevision(),
860 Revision
::loadFromTitle(
861 wfGetDB( DB_MASTER
),
862 $this->testPage
->getTitle(),
863 $this->testPage
->getLatest()
869 * @covers Revision::loadFromTitle
871 public function testLoadFromTitleWithNotLatestRevId() {
872 $this->testPage
->doEditContent( new WikitextContent( __METHOD__
), __METHOD__
);
873 $this->assertRevEquals(
874 $this->testPage
->getRevision()->getPrevious(),
875 Revision
::loadFromTitle(
876 wfGetDB( DB_MASTER
),
877 $this->testPage
->getTitle(),
878 $this->testPage
->getRevision()->getPrevious()->getId()