9 use InvalidArgumentException;
25 use PHPUnit_Framework_MockObject_MockObject;
74 $this->tablesUsed[] =
'archive';
75 $this->tablesUsed[] =
'page';
76 $this->tablesUsed[] =
'revision';
77 $this->tablesUsed[] =
'comment';
98 if ( $this->testPageTitle ) {
110 if ( $this->testPage ) {
117 if ( !$this->testPage->exists() ) {
121 $user = static::getTestSysop()->getUser();
123 $this->testPage->doEditContent(
125 'UTPageSummary-' . __CLASS__,
139 $domain =
new DatabaseDomain( $server[
'dbname'],
null, $server[
'tablePrefix'] );
142 ->setMethods( [
'reallyOpenConnection' ] )
143 ->setConstructorArgs( [
144 [
'servers' => [ $server ],
'localDomain' => $domain ]
148 $lb->method(
'reallyOpenConnection' )->willReturnCallback(
149 function (
array $server, $dbNameOverride ) {
162 ->setMethods( [
'select',
'doQuery',
'open',
'closeConnection',
'isOpen' ] )
163 ->setConstructorArgs( [
$params ] )
167 $db->method(
'isOpen' )->willReturn(
true );
173 yield [
false,
'test',
'' ];
174 yield [
'test',
'test',
'' ];
176 yield [
false,
'test',
'foo_' ];
177 yield [
'test-foo_',
'test',
'foo_' ];
179 yield [
false,
'dash-test',
'' ];
180 yield [
'dash-test',
'dash-test',
'' ];
182 yield [
false,
'underscore_test',
'foo_' ];
183 yield [
'underscore_test-foo_',
'underscore_test',
'foo_' ];
193 'wgDBname' => $dbName,
194 'wgDBprefix' => $dbPrefix,
201 'dbDirectory' =>
'*dummy*',
203 'password' =>
'test',
212 'connLogger' =>
new \Psr\Log\NullLogger(),
213 'queryLogger' =>
new \Psr\Log\NullLogger(),
214 'errorLogger' =>
function () {
216 'deprecationLogger' =>
function () {
220 'tablePrefix' => $dbPrefix,
227 ->disableOriginalConstructor()
243 $count = $store->countRevisionsByPageId(
$db, 0 );
247 $this->assertSame( 0, $count );
272 $this->assertEquals( $r1->
getUser()->getName(), $r2->
getUser()->getName() );
273 $this->assertEquals( $r1->
getUser()->getId(), $r2->
getUser()->getId() );
333 if ( isset( $details[
'user'] ) && $details[
'user'] ===
true ) {
334 $details[
'user'] = $this->
getTestUser()->getUser();
336 if ( isset( $details[
'page'] ) && $details[
'page'] ===
true ) {
339 if ( isset( $details[
'parent'] ) && $details[
'parent'] ===
true ) {
340 $details[
'parent'] = $this->
getTestPage()->getLatest();
345 isset( $details[
'slot'] ) ?
$rev->setSlot( $details[
'slot'] ) :
null;
346 isset( $details[
'parent'] ) ?
$rev->setParentId( $details[
'parent'] ) :
null;
347 isset( $details[
'page'] ) ?
$rev->setPageId( $details[
'page'] ) :
null;
348 isset( $details[
'size'] ) ?
$rev->setSize( $details[
'size'] ) :
null;
349 isset( $details[
'sha1'] ) ?
$rev->setSha1( $details[
'sha1'] ) :
null;
350 isset( $details[
'comment'] ) ?
$rev->setComment( $details[
'comment'] ) :
null;
351 isset( $details[
'timestamp'] ) ?
$rev->setTimestamp( $details[
'timestamp'] ) :
null;
352 isset( $details[
'minor'] ) ?
$rev->setMinorEdit( $details[
'minor'] ) :
null;
353 isset( $details[
'user'] ) ?
$rev->setUser( $details[
'user'] ) :
null;
354 isset( $details[
'visibility'] ) ?
$rev->setVisibility( $details[
'visibility'] ) :
null;
355 isset( $details[
'id'] ) ?
$rev->setId( $details[
'id'] ) :
null;
357 if ( isset( $details[
'content'] ) ) {
358 foreach ( $details[
'content']
as $role =>
$content ) {
367 yield
'Bare minimum revision insertion' => [
372 'timestamp' =>
'20171117010101',
376 yield
'Detailed revision insertion' => [
382 'timestamp' =>
'20171117010101',
401 array $revDetails = []
416 $loaded = $store->getRevisionById( $return->getId() );
428 unset( $row->rev_content_model );
429 unset( $row->rev_content_format );
432 unset( $row->rev_comment_text );
433 unset( $row->rev_comment_data );
434 unset( $row->rev_comment_cid );
435 unset( $row->rev_comment_id );
438 $queryInfo = $store->getQueryInfo( [
'user' ] );
440 $row = get_object_vars( $row );
443 $keys = array_keys( $row );
445 $fields = array_intersect_key( $queryInfo[
'fields'],
$keys ) +
$keys;
452 $queryInfo[
'tables'],
454 [
'rev_id' =>
$rev->getId() ],
455 [ array_values( $row ) ],
479 'timestamp' =>
'20171117010101',
505 $this->assertNotSame( $firstReturn->getId(), $secondReturn->getId() );
508 $this->assertSame( $firstReturn->getId(), $firstMainSlot->getRevision() );
509 $this->assertSame( $secondReturn->getId(), $secondMainSlot->getRevision() );
516 'timestamp' =>
'20171117010101',
519 new InvalidArgumentException(
'main slot must be provided' )
521 yield
'no main slot' => [
525 'timestamp' =>
'20171117010101',
528 new InvalidArgumentException(
'main slot must be provided' )
530 yield
'no timestamp' => [
538 yield
'no comment' => [
541 'timestamp' =>
'20171117010101',
550 'timestamp' =>
'20171117010101',
561 array $revDetails = [],
568 $this->setExpectedException(
569 get_class( $exception ),
570 $exception->getMessage(),
571 $exception->getCode()
602 if ( !$page->exists() ) {
606 $revDetails[
'page'] = $page->getId();
609 $revDetails[
'user'] =
$user;
615 $baseRev = $store->insertRevisionOn( $baseRev, $dbw );
616 $page->updateRevisionOn( $dbw,
new Revision( $baseRev ), $page->getLatest() );
618 $record = $store->newNullRevision(
626 $this->assertEquals(
$title->getNamespace(), $record->getPageAsLinkTarget()->getNamespace() );
627 $this->assertEquals(
$title->getDBkey(), $record->getPageAsLinkTarget()->getDBkey() );
628 $this->assertEquals( $comment, $record->getComment() );
629 $this->assertEquals( $minor, $record->isMinor() );
630 $this->assertEquals(
$user->getName(), $record->getUser()->getName() );
631 $this->assertEquals( $baseRev->getId(), $record->getParentId() );
634 $baseRev->getSlotRoles(),
635 $record->getSlotRoles()
638 foreach ( $baseRev->getSlotRoles()
as $role ) {
639 $parentSlot = $baseRev->getSlot( $role );
640 $slot = $record->getSlot( $role );
642 $this->assertTrue( $slot->isInherited(),
'isInherited' );
643 $this->assertSame( $parentSlot->getOrigin(), $slot->getOrigin(),
'getOrigin' );
653 $record = $store->newNullRevision(
660 $this->assertNull( $record );
673 $revisionRecord = $store->getRevisionById(
$rev->getId() );
674 $result = $store->getRcIdIfUnpatrolled( $revisionRecord );
676 $this->assertGreaterThan( 0,
$result );
678 $store->getRecentChange( $revisionRecord )->getAttribute(
'rc_id' ),
690 $status = $page->doEditContent(
701 $revisionRecord = $store->getRevisionById(
$rev->getId() );
702 $result = $store->getRcIdIfUnpatrolled( $revisionRecord );
704 $this->assertSame( 0,
$result );
718 $revRecord = $store->getRevisionById(
$rev->getId() );
719 $recentChange = $store->getRecentChange( $revRecord );
721 $this->assertEquals(
$rev->getId(), $recentChange->getAttribute(
'rc_this_oldid' ) );
722 $this->assertEquals(
$rev->getRecentChange(), $recentChange );
736 $revRecord = $store->getRevisionById(
$rev->getId() );
738 $this->assertSame(
$rev->getId(), $revRecord->getId() );
740 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
754 $revRecord = $store->getRevisionByTitle( $page->getTitle() );
756 $this->assertSame(
$rev->getId(), $revRecord->getId() );
758 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
772 $revRecord = $store->getRevisionByPageId( $page->getId() );
774 $this->assertSame(
$rev->getId(), $revRecord->getId() );
776 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
794 $revRecord = $store->getRevisionByTimestamp(
799 $this->assertSame(
$rev->getId(), $revRecord->getId() );
801 $this->assertSame( __METHOD__, $revRecord->getComment()->text );
811 'rev_timestamp' => $this->db->timestamp(
$rev->getTimestamp() ),
812 'rev_user_text' => (
string)
$rev->getUserText(),
813 'rev_user' => (
string)
$rev->getUser() ?:
null,
814 'rev_minor_edit' =>
$rev->isMinor() ?
'1' :
'0',
815 'rev_deleted' => (
string)
$rev->getVisibility(),
817 'rev_parent_id' => (
string)
$rev->getParentId(),
821 if ( in_array(
'page',
$options ) ) {
823 'page_namespace' => (
string)$page->getTitle()->getNamespace(),
824 'page_title' => $page->getTitle()->getDBkey(),
825 'page_id' => (
string)$page->getId(),
826 'page_latest' => (
string)$page->getLatest(),
827 'page_is_redirect' => $page->isRedirect() ?
'1' :
'0',
828 'page_len' => (
string)$page->getContent()->getSize(),
832 if ( in_array(
'user',
$options ) ) {
838 if ( in_array(
'comment',
$options ) ) {
840 'rev_comment_text' =>
$rev->getComment(),
841 'rev_comment_data' =>
null,
842 'rev_comment_cid' =>
null,
846 if (
$rev->getId() ) {
852 return (
object)$fields;
859 $this->assertSame(
$rev->getId(), $record->
getId() );
862 $this->assertSame(
$rev->getUserText(), $record->
getUser()->getName() );
863 $this->assertSame(
$rev->getUser(), $record->
getUser()->getId() );
864 $this->assertSame(
$rev->isMinor(), $record->
isMinor() );
866 $this->assertSame(
$rev->getSize(), $record->
getSize() );
871 $expectedParent =
$rev->getParentId();
872 if ( $expectedParent ===
null ) {
875 $this->assertSame( $expectedParent, $record->
getParentId() );
876 $this->assertSame(
$rev->getSha1(), $record->
getSha1() );
877 $this->assertSame(
$rev->getComment(), $record->
getComment()->text );
878 $this->assertSame(
$rev->getContentFormat(),
883 $revRec =
$rev->getRevisionRecord();
887 $this->assertSame( $revMain->hasOrigin(), $recMain->hasOrigin(),
'hasOrigin' );
888 $this->assertSame( $revMain->hasAddress(), $recMain->hasAddress(),
'hasAddress' );
889 $this->assertSame( $revMain->hasContentId(), $recMain->hasContentId(),
'hasContentId' );
891 if ( $revMain->hasOrigin() ) {
892 $this->assertSame( $revMain->getOrigin(), $recMain->getOrigin(),
'getOrigin' );
895 if ( $revMain->hasAddress() ) {
896 $this->assertSame( $revMain->getAddress(), $recMain->getAddress(),
'getAddress' );
899 if ( $revMain->hasContentId() ) {
900 $this->assertSame( $revMain->getContentId(), $recMain->getContentId(),
'getContentId' );
910 $text = __METHOD__ .
'a-ä';
912 $rev = $page->doEditContent(
915 )->value[
'revision'];
918 $info = $store->getQueryInfo();
919 $row = $this->db->selectRow(
922 [
'rev_id' =>
$rev->getId() ],
927 $record = $store->newRevisionFromRow(
933 $this->assertSame( $text,
$rev->getContent()->serialize() );
941 $text = __METHOD__ .
'a-ä';
943 $rev = $page->doEditContent(
946 )->value[
'revision'];
949 $record = $store->newRevisionFromRow(
955 $this->assertSame( $text,
$rev->getContent()->serialize() );
962 $this->
setMwGlobals(
'wgLegacyEncoding',
'windows-1252' );
965 $text = __METHOD__ .
'a-ä';
967 $rev = $page->doEditContent(
970 )->value[
'revision'];
973 $record = $store->newRevisionFromRow(
979 $this->assertSame( $text,
$rev->getContent()->serialize() );
987 $text = __METHOD__ .
'b-ä';
989 $rev = $page->doEditContent(
995 )->value[
'revision'];
998 $record = $store->newRevisionFromRow(
1004 $this->assertSame( $text,
$rev->getContent()->serialize() );
1014 $text = __METHOD__ .
'-bä';
1017 $orig = $page->doEditContent(
new WikitextContent( $text ), __METHOD__ )
1018 ->value[
'revision'];
1019 $page->doDeleteArticle( __METHOD__ );
1022 $arQuery = $store->getArchiveQueryInfo();
1024 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1025 __METHOD__, [], $arQuery[
'joins']
1027 $this->assertTrue( is_object(
$res ),
'query failed' );
1029 $row =
$res->fetchObject();
1031 $record = $store->newRevisionFromArchiveRow( $row );
1034 $this->assertSame( $text, $record->getContent(
SlotRecord::MAIN )->serialize() );
1041 $this->
setMwGlobals(
'wgLegacyEncoding',
'windows-1252' );
1045 $text = __METHOD__ .
'-bä';
1048 $orig = $page->doEditContent(
new WikitextContent( $text ), __METHOD__ )
1049 ->value[
'revision'];
1050 $page->doDeleteArticle( __METHOD__ );
1053 $arQuery = $store->getArchiveQueryInfo();
1055 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1056 __METHOD__, [], $arQuery[
'joins']
1058 $this->assertTrue( is_object(
$res ),
'query failed' );
1060 $row =
$res->fetchObject();
1062 $record = $store->newRevisionFromArchiveRow( $row );
1065 $this->assertSame( $text, $record->getContent(
SlotRecord::MAIN )->serialize() );
1076 'ar_page_id' =>
'2',
1077 'ar_namespace' =>
'0',
1078 'ar_title' =>
'Something',
1080 'ar_text_id' =>
'47',
1081 'ar_timestamp' =>
'20180528192356',
1082 'ar_minor_edit' =>
'0',
1083 'ar_deleted' =>
'0',
1085 'ar_parent_id' =>
'0',
1086 'ar_sha1' =>
'deadbeef',
1087 'ar_comment_text' =>
'whatever',
1088 'ar_comment_data' =>
null,
1089 'ar_comment_cid' =>
null,
1091 'ar_user_text' =>
'',
1093 'ar_content_format' =>
null,
1094 'ar_content_model' =>
null,
1097 \Wikimedia\suppressWarnings();
1098 $record = $store->newRevisionFromArchiveRow( $row );
1099 \Wikimedia\suppressWarnings(
true );
1103 $this->assertSame(
'Unknown user', $record->getUser()->getName() );
1116 'page_namespace' =>
'0',
1117 'page_title' =>
$title->getText(),
1118 'rev_text_id' =>
'47',
1119 'rev_timestamp' =>
'20180528192356',
1120 'rev_minor_edit' =>
'0',
1121 'rev_deleted' =>
'0',
1123 'rev_parent_id' =>
'0',
1124 'rev_sha1' =>
'deadbeef',
1125 'rev_comment_text' =>
'whatever',
1126 'rev_comment_data' =>
null,
1127 'rev_comment_cid' =>
null,
1129 'rev_user_text' =>
'',
1130 'rev_actor' =>
null,
1131 'rev_content_format' =>
null,
1132 'rev_content_model' =>
null,
1135 \Wikimedia\suppressWarnings();
1136 $record = $store->newRevisionFromRow( $row, 0,
$title );
1137 \Wikimedia\suppressWarnings(
true );
1139 $this->assertNotNull( $record );
1140 $this->assertNotNull( $record->getUser() );
1141 $this->assertNotEmpty( $record->getUser()->getName() );
1156 $page->doEditContent(
new WikitextContent(
"First" ), __METHOD__ .
'-first' );
1157 $origRev = $page->doEditContent(
new WikitextContent(
"Foo" ), __METHOD__ )
1158 ->value[
'revision'];
1159 $orig = $origRev->getRevisionRecord();
1160 $page->doDeleteArticle( __METHOD__ );
1166 $arQuery = $store->getArchiveQueryInfo();
1167 $row =
$db->selectRow(
1168 $arQuery[
'tables'], $arQuery[
'fields'], [
'ar_rev_id' => $orig->getId() ],
1169 __METHOD__, [], $arQuery[
'joins']
1172 $this->assertNotFalse( $row,
'query failed' );
1174 $record = $store->newRevisionFromArchiveRow(
1178 [
'page_id' =>
$title->getArticleID() ]
1181 $restored = $store->insertRevisionOn( $record,
$db );
1190 $this->assertSame( $recMain->getAddress(), $restMain->getAddress() );
1191 $this->assertSame( $recMain->getContentId(), $restMain->getContentId() );
1192 $this->assertSame( $recMain->getOrigin(), $restMain->getOrigin() );
1193 $this->assertSame(
'Foo', $restMain->getContent()->serialize() );
1196 $loaded = $store->getRevisionById( $restored->getId() );
1197 $this->assertNotNull( $loaded );
1213 ->value[
'revision'];
1228 ->value[
'revision'];
1243 ->value[
'revision'];
1257 $revOne = $page->doEditContent(
new WikitextContent( __METHOD__ ), __METHOD__ )
1258 ->value[
'revision'];
1262 $revTwo = $page->doEditContent(
new WikitextContent( __METHOD__ .
'a' ),
'' )
1263 ->value[
'revision'];
1271 $store->loadRevisionFromTimestamp(
1274 $revOne->getTimestamp()
1279 $store->loadRevisionFromTimestamp(
1282 $revTwo->getTimestamp()
1293 $revOne = $page->doEditContent(
1295 )->value[
'revision'];
1297 $revTwo = $page->doEditContent(
1299 )->value[
'revision'];
1304 $revOne->getId() => strlen( __METHOD__ ),
1306 $store->listRevisionSizes(
1308 [ $revOne->getId() ]
1313 $revOne->getId() => strlen( __METHOD__ ),
1314 $revTwo->getId() => strlen( __METHOD__ ) + 1,
1316 $store->listRevisionSizes(
1318 [ $revOne->getId(), $revTwo->getId() ]
1329 $revOne = $page->doEditContent(
1331 )->value[
'revision'];
1333 $revTwo = $page->doEditContent(
1335 )->value[
'revision'];
1339 $store->getPreviousRevision( $store->getRevisionById( $revOne->getId() ) )
1343 $store->getPreviousRevision( $store->getRevisionById( $revTwo->getId() ) )->getId()
1353 $revOne = $page->doEditContent(
1355 )->value[
'revision'];
1357 $revTwo = $page->doEditContent(
1359 )->value[
'revision'];
1364 $store->getNextRevision( $store->getRevisionById( $revOne->getId() ) )->getId()
1367 $store->getNextRevision( $store->getRevisionById( $revTwo->getId() ) )
1380 'ar_rev_id' => 34567,
1383 'ar_minor_edit' => 0,
1384 'ar_timestamp' =>
'20180101020202',
1397 $this->assertNull( $store->getPreviousRevision(
$rev ) );
1406 $this->assertNull( $store->getNextRevision(
$rev ) );
1416 ->value[
'revision'];
1419 $result = $store->getTimestampFromId(
1424 $this->assertSame(
$rev->getTimestamp(),
$result );
1434 ->value[
'revision'];
1437 $result = $store->getTimestampFromId(
1442 $this->assertFalse(
$result );
1497 $page->doEditContent(
new WikitextContent( __METHOD__ ), __METHOD__ );
1500 $result = $store->userWasLastToEdit(
1506 $this->assertFalse(
$result );
1516 $page->doEditContent(
1525 $result = $store->userWasLastToEdit(
1540 $rev = $page->doEditContent(
1546 )->value[
'revision'];
1549 $record = $store->getKnownCurrentRevision(
1558 yield
'Basic array, content object' => [
1562 'timestamp' =>
'20171017114835',
1563 'user_text' =>
'111.0.1.2',
1565 'minor_edit' =>
false,
1569 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1570 'comment' =>
'Goat Comment!',
1574 yield
'Basic array, serialized text' => [
1578 'timestamp' =>
'20171017114835',
1579 'user_text' =>
'111.0.1.2',
1581 'minor_edit' =>
false,
1585 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1586 'comment' =>
'Goat Comment!',
1590 yield
'Basic array, serialized text, utf-8 flags' => [
1594 'timestamp' =>
'20171017114835',
1595 'user_text' =>
'111.0.1.2',
1597 'minor_edit' =>
false,
1601 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1602 'comment' =>
'Goat Comment!',
1607 yield
'Basic array, with title' => [
1610 'timestamp' =>
'20171017114835',
1611 'user_text' =>
'111.0.1.2',
1613 'minor_edit' =>
false,
1617 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1618 'comment' =>
'Goat Comment!',
1622 yield
'Basic array, no user field' => [
1626 'timestamp' =>
'20171017114835',
1627 'user_text' =>
'111.0.1.3',
1628 'minor_edit' =>
false,
1632 'sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
1633 'comment' =>
'Goat Comment!',
1647 if ( isset( $array[
'page'] ) ) {
1649 if ( !
$t || !
$t->exists() ) {
1652 $array[
'page'] = $info[
'id'];
1656 $result = $store->newMutableRevisionFromArray( $array );
1658 if ( isset( $array[
'id'] ) ) {
1659 $this->assertSame( $array[
'id'],
$result->getId() );
1661 if ( isset( $array[
'page'] ) ) {
1662 $this->assertSame( $array[
'page'],
$result->getPageId() );
1664 $this->assertSame( $array[
'timestamp'],
$result->getTimestamp() );
1665 $this->assertSame( $array[
'user_text'],
$result->getUser()->getName() );
1666 if ( isset( $array[
'user'] ) ) {
1667 $this->assertSame( $array[
'user'],
$result->getUser()->getId() );
1669 $this->assertSame( (
bool)$array[
'minor_edit'],
$result->isMinor() );
1670 $this->assertSame( $array[
'deleted'],
$result->getVisibility() );
1671 $this->assertSame( $array[
'len'],
$result->getSize() );
1672 $this->assertSame( $array[
'parent_id'],
$result->getParentId() );
1673 $this->assertSame( $array[
'sha1'],
$result->getSha1() );
1674 $this->assertSame( $array[
'comment'],
$result->getComment()->text );
1675 if ( isset( $array[
'content'] ) ) {
1676 foreach ( $array[
'content']
as $role =>
$content ) {
1681 } elseif ( isset( $array[
'text'] ) ) {
1682 $this->assertSame( $array[
'text'],
1684 } elseif ( isset( $array[
'content_format'] ) ) {
1686 $array[
'content_format'],
1704 ->setMethods( [
'newBlobStore',
'newSqlBlobStore' ] )
1705 ->disableOriginalConstructor()
1707 $factory->expects( $this->
any() )
1708 ->method(
'newBlobStore' )
1709 ->willReturn( $blobStore );
1710 $factory->expects( $this->
any() )
1711 ->method(
'newSqlBlobStore' )
1712 ->willReturn( $blobStore );
1714 $this->
setService(
'BlobStoreFactory', $factory );
1732 return $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1750 $userNameBefore =
$rev->getUser()->getName();
1753 $newUserName =
"Renamed $userNameBefore";
1754 $this->db->update(
'revision',
1755 [
'rev_user_text' => $newUserName ],
1756 [
'rev_id' =>
$rev->getId() ] );
1757 $this->db->update(
'user',
1758 [
'user_name' => $newUserName ],
1759 [
'user_id' =>
$rev->getUser()->getId() ] );
1761 $this->db->update(
'actor',
1762 [
'actor_name' => $newUserName ],
1763 [
'actor_user' =>
$rev->getUser()->getId() ] );
1767 $revAfter = $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1768 $userNameAfter = $revAfter->getUser()->getName();
1772 $this->assertNotSame( $userNameBefore, $userNameAfter );
1775 $this->assertSame( $newUserName, $userNameAfter );
1791 $deletedBefore =
$rev->getVisibility();
1794 $this->db->update(
'revision',
1796 [
'rev_id' =>
$rev->getId() ] );
1799 $revAfter = $store->getKnownCurrentRevision( $page->getTitle(),
$rev->getId() );
1800 $deletedAfter = $revAfter->getVisibility();
1804 $this->assertNotSame( $deletedBefore, $deletedAfter );
1819 $rev = $page->doEditContent(
1825 )->value[
'revision'];
1828 $record = $store->newRevisionFromRow(
1835 $userNameBefore = $record->getUser()->getName();
1838 $newUserName =
"Renamed $userNameBefore";
1839 $this->db->update(
'revision',
1840 [
'rev_user_text' => $newUserName ],
1841 [
'rev_id' => $record->getId() ] );
1842 $this->db->update(
'user',
1843 [
'user_name' => $newUserName ],
1844 [
'user_id' => $record->getUser()->getId() ] );
1846 $this->db->update(
'actor',
1847 [
'actor_name' => $newUserName ],
1848 [
'actor_user' => $record->getUser()->getId() ] );
1853 $recordAfter = $store->newRevisionFromRow(
1859 $userNameAfter = $recordAfter->getUser()->getName();
1863 $this->assertNotSame( $userNameBefore, $userNameAfter );
1866 $this->assertSame( $newUserName, $userNameAfter );
1876 $rev = $page->doEditContent(
1879 )->value[
'revision'];
1882 $record = $store->newRevisionFromRow(
1889 $deletedBefore = $record->getVisibility();
1892 $this->db->update(
'revision',
1894 [
'rev_id' => $record->getId() ] );
1898 $recordAfter = $store->newRevisionFromRow(
1904 $deletedAfter = $recordAfter->getVisibility();
1907 $this->assertNotSame( $deletedBefore, $deletedAfter );