Go to the documentation of this file.
21 yield
'with text' => [
23 'text' =>
'hello world.',
27 yield
'with content' => [
42 ->disableOriginalConstructor()
44 $mock->expects( $this->
any() )
45 ->method(
'getNamespace' )
47 $mock->expects( $this->
any() )
48 ->method(
'getPrefixedText' )
49 ->will( $this->returnValue(
'RevisionTest' ) );
50 $mock->expects( $this->
any() )
51 ->method(
'getDBkey' )
52 ->will( $this->returnValue(
'RevisionTest' ) );
53 $mock->expects( $this->
any() )
54 ->method(
'getArticleID' )
55 ->will( $this->returnValue( 23 ) );
56 $mock->expects( $this->
any() )
57 ->method(
'getContentModel' )
58 ->will( $this->returnValue( $model ) );
70 $this->assertNotNull(
$rev->getContent(),
'no content object available' );
81 $this->assertNull(
$rev->getContent(),
'no content object should be available' );
89 Wikimedia\suppressWarnings();
91 $this->assertSame( 77777777,
$rev->getPage() );
92 Wikimedia\restoreWarnings();
96 yield
'no user defaults to wgUser' => [
103 yield
'user text and id' => [
106 'user_text' =>
'SomeTextUserName',
113 yield
'user text only' => [
116 'user_text' =>
'111.111.111.111',
139 if ( $expectedUserId ===
null ) {
140 $expectedUserId = $testUser->getId();
142 if ( $expectedUserName ===
null ) {
143 $expectedUserName = $testUser->getName();
147 $this->assertEquals( $expectedUserId,
$rev->getUser() );
148 $this->assertEquals( $expectedUserName,
$rev->getUserText() );
152 yield
'content and text_id both not empty' => [
155 'text_id' =>
'someid',
157 new MWException(
"Text already stored in external store (id someid), " .
158 "can't serialize content object" )
160 yield
'with bad content object (class)' => [
161 [
'content' =>
new stdClass() ],
162 new MWException(
'content field must contain a Content object.' )
164 yield
'with bad content object (string)' => [
165 [
'content' =>
'ImAGoat' ],
166 new MWException(
'content field must contain a Content object.' )
168 yield
'bad row format' => [
169 'imastring, not a row',
170 new InvalidArgumentException(
171 '$row must be a row object, an associative array, or a RevisionRecord'
182 $this->setExpectedException(
183 get_class( $expectedException ),
184 $expectedException->getMessage(),
185 $expectedException->getCode()
195 $this->setExpectedException(
202 yield
'Full construction' => [
206 'rev_text_id' =>
'2',
207 'rev_timestamp' =>
'20171017114835',
208 'rev_user_text' =>
'127.0.0.1',
210 'rev_minor_edit' =>
'0',
211 'rev_deleted' =>
'0',
213 'rev_parent_id' =>
'1',
214 'rev_sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
215 'rev_comment_text' =>
'Goat Comment!',
216 'rev_comment_data' =>
null,
217 'rev_comment_cid' =>
null,
218 'rev_content_format' =>
'GOATFORMAT',
219 'rev_content_model' =>
'GOATMODEL',
222 $testCase->assertSame( 42,
$rev->getId() );
223 $testCase->assertSame( 23,
$rev->getPage() );
224 $testCase->assertSame( 2,
$rev->getTextId() );
225 $testCase->assertSame(
'20171017114835',
$rev->getTimestamp() );
226 $testCase->assertSame(
'127.0.0.1',
$rev->getUserText() );
227 $testCase->assertSame( 0,
$rev->getUser() );
228 $testCase->assertSame(
false,
$rev->isMinor() );
230 $testCase->assertSame( 46,
$rev->getSize() );
231 $testCase->assertSame( 1,
$rev->getParentId() );
232 $testCase->assertSame(
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
$rev->getSha1() );
233 $testCase->assertSame(
'Goat Comment!',
$rev->getComment() );
234 $testCase->assertSame(
'GOATFORMAT',
$rev->getContentFormat() );
235 $testCase->assertSame(
'GOATMODEL',
$rev->getContentModel() );
238 yield
'default field values' => [
242 'rev_text_id' =>
'2',
243 'rev_timestamp' =>
'20171017114835',
244 'rev_user_text' =>
'127.0.0.1',
246 'rev_minor_edit' =>
'0',
247 'rev_deleted' =>
'0',
248 'rev_comment_text' =>
'Goat Comment!',
249 'rev_comment_data' =>
null,
250 'rev_comment_cid' =>
null,
254 $testCase->assertSame(
null,
$rev->getParentId(),
'revision id' );
257 $testCase->assertSame(
$rev->getTimestamp(),
'20171017114835',
'timestamp' );
258 $testCase->assertSame(
$rev->getUserText(),
'127.0.0.1',
'user name' );
259 $testCase->assertSame(
$rev->getUser(), 0,
'user id' );
260 $testCase->assertSame(
$rev->getComment(),
'Goat Comment!' );
261 $testCase->assertSame(
false,
$rev->isMinor(),
'minor edit' );
262 $testCase->assertSame( 0,
$rev->getVisibility(),
'visibility flags' );
265 $testCase->assertNotNull(
$rev->getSize(),
'size' );
266 $testCase->assertNotNull(
$rev->getSha1(),
'hash' );
269 $testCase->assertSame(
'text/x-wiki',
$rev->getContentFormat(),
'format' );
270 $testCase->assertSame(
'wikitext',
$rev->getContentModel(),
'model' );
281 $data =
'Hello goat.';
284 ->disableOriginalConstructor()
287 $blobStore->method(
'getBlob' )
288 ->will( $this->returnValue( $data ) );
290 $blobStore->method(
'getTextIdFromAddress' )
291 ->will( $this->returnCallback(
292 function ( $address ) {
296 $parts = explode(
':', $address );
297 return (
int)array_pop( $parts );
304 $row = (
object)$arrayData;
306 $assertions( $this,
$rev );
316 Wikimedia\suppressWarnings();
317 $rev =
new Revision( (
object)[
'rev_page' => 77777777 ] );
318 $this->assertSame( 77777777,
$rev->getPage() );
319 Wikimedia\restoreWarnings();
323 yield
'Generic test' => [
324 'This is a goat of revision text.',
327 'old_text' =>
'This is a goat of revision text.',
349 $this->assertEquals( $expectedId,
$rev->getId() );
353 yield [
'123', 123 ];
364 $this->assertSame( $expected,
$rev->getId() );
368 yield [
'123', 123,
'GOaT' ];
369 yield [ 456, 456,
'GOaT' ];
378 $rev->setUserIdAndName( $inputId,
$name );
385 yield [ [
'text_id' =>
'123' ], 123 ];
386 yield [ [
'text_id' => 456 ], 456 ];
395 $this->assertSame( $expected,
$rev->getTextId() );
400 yield [ [
'parent_id' =>
'123' ], 123 ];
401 yield [ [
'parent_id' => 456 ], 456 ];
410 $this->assertSame( $expected,
$rev->getParentId() );
424 yield
'Generic gzip test' => [
425 'This is a small goat of revision text.',
427 'old_flags' =>
'gzip',
428 'old_text' => gzdeflate(
'This is a small goat of revision text.' ),
452 ->disableOriginalConstructor()
464 ->disableOriginalConstructor()
466 $factory->expects( $this->
any() )
467 ->method(
'newBlobStore' )
468 ->willReturn( $blobStore );
469 $factory->expects( $this->
any() )
470 ->method(
'newSqlBlobStore' )
471 ->willReturn( $blobStore );
481 ->disableOriginalConstructor()
490 MediaWikiServices::getInstance()->getCommentStore(),
491 MediaWikiServices::getInstance()->getActorMigration()
497 yield
'Utf8Native' => [
498 "Wiki est l'\xc3\xa9cole superieur !",
502 'old_flags' =>
'utf-8',
503 'old_text' =>
"Wiki est l'\xc3\xa9cole superieur !",
506 yield
'Utf8Legacy' => [
507 "Wiki est l'\xc3\xa9cole superieur !",
512 'old_text' =>
"Wiki est l'\xe9cole superieur !",
535 yield
'Utf8NativeGzip' => [
536 "Wiki est l'\xc3\xa9cole superieur !",
540 'old_flags' =>
'gzip,utf-8',
541 'old_text' => gzdeflate(
"Wiki est l'\xc3\xa9cole superieur !" ),
544 yield
'Utf8LegacyGzip' => [
545 "Wiki est l'\xc3\xa9cole superieur !",
549 'old_flags' =>
'gzip',
550 'old_text' => gzdeflate(
"Wiki est l'\xe9cole superieur !" ),
574 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
576 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
577 "Flags should contain 'utf-8'" );
578 $this->assertFalse(
false !== strpos( $row->old_flags,
'gzip' ),
579 "Flags should not contain 'gzip'" );
580 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
581 $row->old_text,
"Direct check" );
582 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
593 $blobStore->setCompressBlobs(
true );
597 $row->old_text =
"Wiki est l'\xc3\xa9cole superieur !";
599 $this->assertTrue(
false !== strpos( $row->old_flags,
'utf-8' ),
600 "Flags should contain 'utf-8'" );
601 $this->assertTrue(
false !== strpos( $row->old_flags,
'gzip' ),
602 "Flags should contain 'gzip'" );
603 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
604 gzinflate( $row->old_text ),
"Direct check" );
605 $this->assertEquals(
"Wiki est l'\xc3\xa9cole superieur !",
619 'rev_id=page_latest',
620 'page_namespace' =>
$title->getNamespace(),
621 'page_title' =>
$title->getDBkey()
626 'rev_page' =>
$title->getArticleID(),
627 'rev_text_id' =>
'2',
628 'rev_timestamp' =>
'20171017114835',
629 'rev_user_text' =>
'127.0.0.1',
631 'rev_minor_edit' =>
'0',
632 'rev_deleted' =>
'0',
634 'rev_parent_id' =>
'1',
635 'rev_sha1' =>
'rdqbbzs3pkhihgbs8qf2q9jsvheag5z',
636 'rev_comment_text' =>
'Goat Comment!',
637 'rev_comment_data' =>
null,
638 'rev_comment_cid' =>
null,
639 'rev_content_format' =>
'GOATFORMAT',
640 'rev_content_model' =>
'GOATMODEL',
644 $db->expects( $this->
any() )
645 ->method(
'getDomainId' )
646 ->will( $this->returnValue(
wfWikiID() ) );
647 $db->expects( $this->once() )
648 ->method(
'selectRow' )
650 $this->equalTo( [
'revision',
'page',
'user' ] ),
652 $this->isType(
'array' ),
653 $this->equalTo( $conditions ),
655 $this->stringContains(
'fetchRevisionRowFromConds' ),
657 $this->isType(
'array' ),
659 $this->isType(
'array' )
661 ->willReturn( $row );
665 $this->assertEquals(
$title->getArticleID(), $revision->getTitle()->getArticleID() );
666 $this->assertEquals( $row->rev_id, $revision->getId() );
667 $this->assertEquals( $row->rev_len, $revision->getSize() );
668 $this->assertEquals( $row->rev_sha1, $revision->getSha1() );
669 $this->assertEquals( $row->rev_parent_id, $revision->getParentId() );
670 $this->assertEquals( $row->rev_timestamp, $revision->getTimestamp() );
671 $this->assertEquals( $row->rev_comment_text, $revision->getComment() );
672 $this->assertEquals( $row->rev_user_text, $revision->getUserText() );
676 yield
'(no legacy encoding), false in false out' => [
false,
false, [],
false ];
677 yield
'(no legacy encoding), empty in empty out' => [
false,
'', [],
'' ];
678 yield
'(no legacy encoding), empty in empty out' => [
false,
'A', [],
'A' ];
679 yield
'(no legacy encoding), string in with gzip flag returns string' => [
681 false,
"sttttr\002\022\000", [
'gzip' ],
'AAAABBAAA',
683 yield
'(no legacy encoding), string in with object flag returns false' => [
685 false,
"s:4:\"JOJO\";", [
'object' ],
false,
687 yield
'(no legacy encoding), serialized object in with object flag returns string' => [
694 yield
'(no legacy encoding), serialized object in with object & gzip flag returns string' => [
698 [
'object',
'gzip' ],
701 yield
'(ISO-8859-1 encoding), string in string out' => [
703 iconv(
'utf-8',
'ISO-8859-1',
"1®Àþ1" ),
707 yield
'(ISO-8859-1 encoding), serialized object in with gzip flags returns string' => [
709 gzdeflate( iconv(
'utf-8',
'ISO-8859-1',
"4®Àþ4" ) ),
713 yield
'(ISO-8859-1 encoding), serialized object in with object flags returns string' => [
719 yield
'(ISO-8859-1 encoding), serialized object in with object & gzip flags returns string' => [
722 [
'gzip',
'object' ],
738 if ( $legacyEncoding ) {
757 yield
'Just text' => [
758 (
object)[
'old_text' =>
'SomeText' ],
763 yield
'gzip text' => [
765 'old_text' =>
"sttttr\002\022\000",
766 'old_flags' =>
'gzip'
771 yield
'gzip text and different prefix' => [
773 'jojo_text' =>
"sttttr\002\022\000",
774 'jojo_flags' =>
'gzip'
794 yield
'Just some text' => [
'someNonUrlText' ];
795 yield
'No second URL part' => [
'someProtocol://' ];
809 'old_flags' =>
'external',
820 'ExternalStoreFactory',
827 'old_text' =>
'ForTesting://cluster1/12345',
828 'old_flags' =>
'external,gzip',
842 'ExternalStoreFactory',
847 ->disableOriginalConstructor()
857 'old_text' =>
'ForTesting://cluster1/12345',
858 'old_flags' =>
'external,gzip',
864 $cacheKey =
$cache->makeKey(
'revisiontext',
'textid',
'tt:7777' );
865 $this->assertSame(
'AAAABBAAA',
$cache->get( $cacheKey ) );
876 [
'LEFT JOIN', [
'rev_user != 0',
'user_id = rev_user' ] ],
887 [
'INNER JOIN', [
'page_id = rev_page' ] ],
894 ->disableOriginalConstructor()
896 $mockStore->expects( $this->
any() )
897 ->method(
'getFields' )
898 ->willReturn( [
'commentstore' =>
'fields' ] );
899 $mockStore->expects( $this->
any() )
900 ->method(
'getJoin' )
902 'tables' => [
'commentstore' =>
'table' ],
903 'fields' => [
'commentstore' =>
'field' ],
904 'joins' => [
'commentstore' =>
'join' ],
906 $this->
setService(
'CommentStore', $mockStore );
909 ->disableOriginalConstructor()
911 $mockStore->expects( $this->
any() )
912 ->method(
'getJoin' )
913 ->willReturnCallback(
function ( $key ) {
914 $p = strtok( $key,
'_' );
916 'tables' => [
'actormigration' =>
'table' ],
918 $p .
'_user' =>
'actormigration_user',
919 $p .
'_user_text' =>
'actormigration_user_text',
920 $p .
'_actor' =>
'actormigration_actor',
922 'joins' => [
'actormigration' =>
'join' ],
925 $this->
setService(
'ActorMigration', $mockStore );
938 'rev_actor' =>
'NULL',
944 'commentstore' =>
'fields',
945 'rev_content_format',
958 'rev_actor' =>
'NULL',
964 'commentstore' =>
'fields',
975 $this->
setMwGlobals(
'wgContentHandlerUseDB', $contentHandlerUseDB );
992 'ar_actor' =>
'NULL',
998 'commentstore' =>
'fields',
1013 'ar_actor' =>
'NULL',
1019 'commentstore' =>
'fields',
1030 $this->
setMwGlobals(
'wgContentHandlerUseDB', $contentHandlerUseDB );
1041 $this->assertEquals(
1055 $this->assertEquals(
1073 $this->assertEquals(
1082 yield
'wgContentHandlerUseDB false' => [
1084 'wgContentHandlerUseDB' =>
false,
1089 'commentstore' =>
'table',
1090 'actormigration' =>
'table',
1105 'commentstore' =>
'field',
1106 'ar_user' =>
'actormigration_user',
1107 'ar_user_text' =>
'actormigration_user_text',
1108 'ar_actor' =>
'actormigration_actor',
1110 'joins' => [
'commentstore' =>
'join',
'actormigration' =>
'join' ],
1113 yield
'wgContentHandlerUseDB true' => [
1115 'wgContentHandlerUseDB' =>
true,
1120 'commentstore' =>
'table',
1121 'actormigration' =>
'table',
1136 'commentstore' =>
'field',
1137 'ar_user' =>
'actormigration_user',
1138 'ar_user_text' =>
'actormigration_user_text',
1139 'ar_actor' =>
'actormigration_actor',
1140 'ar_content_format',
1143 'joins' => [
'commentstore' =>
'join',
'actormigration' =>
'join' ],
1157 $revisionStore->setContentHandlerUseDB( $globals[
'wgContentHandlerUseDB'] );
1158 $this->
setService(
'RevisionStore', $revisionStore );
1159 $this->assertEquals(
1166 yield
'wgContentHandlerUseDB false, opts none' => [
1168 'wgContentHandlerUseDB' =>
false,
1172 'tables' => [
'revision',
'commentstore' =>
'table',
'actormigration' =>
'table' ],
1183 'commentstore' =>
'field',
1184 'rev_user' =>
'actormigration_user',
1185 'rev_user_text' =>
'actormigration_user_text',
1186 'rev_actor' =>
'actormigration_actor',
1188 'joins' => [
'commentstore' =>
'join',
'actormigration' =>
'join' ],
1191 yield
'wgContentHandlerUseDB false, opts page' => [
1193 'wgContentHandlerUseDB' =>
false,
1197 'tables' => [
'revision',
'commentstore' =>
'table',
'actormigration' =>
'table',
'page' ],
1208 'commentstore' =>
'field',
1209 'rev_user' =>
'actormigration_user',
1210 'rev_user_text' =>
'actormigration_user_text',
1211 'rev_actor' =>
'actormigration_actor',
1222 [
'page_id = rev_page' ],
1224 'commentstore' =>
'join',
1225 'actormigration' =>
'join',
1229 yield
'wgContentHandlerUseDB false, opts user' => [
1231 'wgContentHandlerUseDB' =>
false,
1235 'tables' => [
'revision',
'commentstore' =>
'table',
'actormigration' =>
'table',
'user' ],
1246 'commentstore' =>
'field',
1247 'rev_user' =>
'actormigration_user',
1248 'rev_user_text' =>
'actormigration_user_text',
1249 'rev_actor' =>
'actormigration_actor',
1256 'actormigration_user != 0',
1257 'user_id = actormigration_user',
1260 'commentstore' =>
'join',
1261 'actormigration' =>
'join',
1265 yield
'wgContentHandlerUseDB false, opts text' => [
1267 'wgContentHandlerUseDB' =>
false,
1271 'tables' => [
'revision',
'commentstore' =>
'table',
'actormigration' =>
'table',
'text' ],
1282 'commentstore' =>
'field',
1283 'rev_user' =>
'actormigration_user',
1284 'rev_user_text' =>
'actormigration_user_text',
1285 'rev_actor' =>
'actormigration_actor',
1292 [
'rev_text_id=old_id' ],
1294 'commentstore' =>
'join',
1295 'actormigration' =>
'join',
1299 yield
'wgContentHandlerUseDB false, opts 3' => [
1301 'wgContentHandlerUseDB' =>
false,
1303 [
'text',
'page',
'user' ],
1306 'revision',
'commentstore' =>
'table',
'actormigration' =>
'table',
'page',
'user',
'text'
1318 'commentstore' =>
'field',
1319 'rev_user' =>
'actormigration_user',
1320 'rev_user_text' =>
'actormigration_user_text',
1321 'rev_actor' =>
'actormigration_actor',
1335 [
'page_id = rev_page' ],
1340 'actormigration_user != 0',
1341 'user_id = actormigration_user',
1346 [
'rev_text_id=old_id' ],
1348 'commentstore' =>
'join',
1349 'actormigration' =>
'join',
1353 yield
'wgContentHandlerUseDB true, opts none' => [
1355 'wgContentHandlerUseDB' =>
true,
1359 'tables' => [
'revision',
'commentstore' =>
'table',
'actormigration' =>
'table' ],
1370 'commentstore' =>
'field',
1371 'rev_user' =>
'actormigration_user',
1372 'rev_user_text' =>
'actormigration_user_text',
1373 'rev_actor' =>
'actormigration_actor',
1374 'rev_content_format',
1375 'rev_content_model',
1377 'joins' => [
'commentstore' =>
'join',
'actormigration' =>
'join' ],
1391 $revisionStore->setContentHandlerUseDB( $globals[
'wgContentHandlerUseDB'] );
1392 $this->
setService(
'RevisionStore', $revisionStore );
1394 $this->assertEquals(
1409 $this->assertSame( 0,
$rev->getSize(),
'Size of no slots is 0' );
1411 $rec->setSize( 13 );
1412 $this->assertSame( 13,
$rev->getSize() );
1422 ->disableOriginalConstructor()
1425 $rec->method(
'getSize' )
1429 $this->assertNull(
$rev->getSize() );
1441 $emptyHash = SlotRecord::base36Sha1(
'' );
1442 $this->assertSame( $emptyHash,
$rev->getSha1(),
'Sha1 of no slots is hash of empty string' );
1444 $rec->setSha1(
'deadbeef' );
1445 $this->assertSame(
'deadbeef',
$rev->getSha1() );
1455 ->disableOriginalConstructor()
1458 $rec->method(
'getSha1' )
1462 $this->assertNull(
$rev->getSha1() );
1474 $this->assertNull(
$rev->getContent(),
'Content of no slots is null' );
1477 $rec->setContent(
'main', $content );
1478 $this->assertSame( $content,
$rev->getContent() );
1488 ->disableOriginalConstructor()
1491 $rec->method(
'getContent' )
1495 $this->assertNull(
$rev->getContent() );
testSetId( $input, $expected)
provideSetId Revision::setId
testGetSha1()
Revision::getSha1.
testGetArchiveQueryInfo( $globals, $expected)
Revision::getArchiveQueryInfo provideGetArchiveQueryInfo.
testConstructFromEmptyArray()
Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest object
processing should stop and the error should be shown to the user * false
provideDecompressRevisionText()
testGetTextId( $rowArray, $expected)
provideGetTextId Revision::getTextId()
static pageJoinCond()
Return the value of a select() page conds array for the page table.
provideGetArchiveQueryInfo()
Simple store for keeping values in an associative array for the current process.
if(!isset( $args[0])) $lang
testSelectArchiveFields( $contentHandlerUseDB, $expected)
provideSelectArchiveFields Revision::selectArchiveFields
testConstructFromArray_userSetAsExpected(array $rowArray, $expectedUserId, $expectedUserName)
provideConstructFromArray_userSetAsExpected Revision::__construct \MediaWiki\Storage\RevisionStore::n...
testGetRevisionText_external_oldId()
Revision::getRevisionText.
provideSelectArchiveFields()
testConstructFromArrayThrowsExceptions( $rowArray, Exception $expectedException)
provideConstructFromArrayThrowsExceptions Revision::__construct \MediaWiki\Storage\RevisionStore::new...
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
testUserJoinCond()
Revision::userJoinCond.
testGetRevisionText_returnsFalseWhenNoTextField()
Revision::getRevisionText.
provideGetRevisionTextWithZlibExtension()
static getRevisionText( $row, $prefix='old_', $wiki=false)
Get revision text associated with an old or archive row.
static getArchiveQueryInfo()
Return the tables, fields, and join conditions to be selected to create a new archived revision objec...
testConstructFromRowWithBadPageId()
Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray.
Allows to change the fields on the form that will be generated $name
testGetSize_failure()
Revision::getSize.
const CONTENT_MODEL_WIKITEXT
testGetRevisionWithGzipAndLegacyEncoding( $expected, $lang, $encoding, $rowData)
Revision::getRevisionText provideGetRevisionTextWithGzipAndLegacyEncoding.
testGetQueryInfo( $globals, $options, $expected)
Revision::getQueryInfo provideGetQueryInfo.
testSelectFields( $contentHandlerUseDB, $expected)
provideSelectFields Revision::selectFields
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
provideConstructFromArray()
provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts()
static selectTextFields()
Return the list of text fields that should be selected to read the revision text.
mockBlobStoreFactory( $blobStore)
testPageJoinCond()
Revision::pageJoinCond.
testCompressRevisionTextUtf8Gzip()
Revision::compressRevisionText.
static getQueryInfo( $options=[])
Return the tables, fields, and join conditions to be selected to create a new revision object.
namespace and then decline to actually register it file or subcat img or subcat $title
testSetUserIdAndName( $inputId, $expectedId, $name)
provideSetUserIdAndName Revision::setUserIdAndName
testGetRevisionWithLegacyEncoding( $expected, $lang, $encoding, $rowData)
Revision::getRevisionText provideGetRevisionTextWithLegacyEncoding.
if(is_array( $mode)) switch( $mode) $input
static compressRevisionText(&$text)
If $wgCompressRevisions is enabled, we will compress data.
provideGetRevisionTextWithGzipAndLegacyEncoding()
provideConstructFromArrayThrowsExceptions()
testGetContent()
Revision::getContent.
Content object for wiki text pages.
Test cases in RevisionTest should not interact with the Database.
Content for JavaScript pages.
provideGetRevisionTextWithLegacyEncoding()
static selectPageFields()
Return the list of page fields that should be selected from page table.
testGetSize()
Revision::getSize.
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
provideSetUserIdAndName()
static selectArchiveFields()
Return the list of revision fields that should be selected to create a new revision from an archive r...
provideConstructFromArray_userSetAsExpected()
Multi-datacenter aware caching interface.
testSelectPageFields()
Revision::selectPageFields.
testDecompressRevisionText( $legacyEncoding, $text, $flags, $expected)
provideDecompressRevisionText Revision::decompressRevisionText
testConstructFromRow(array $arrayData, $assertions)
provideConstructFromRow Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionFro...
testConstructFromArray( $rowArray)
provideConstructFromArray Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionF...
testGetRevisionText_external_noOldId()
Revision::getRevisionText.
testGetContent_failure()
Revision::getContent.
testSelectTextFields()
Revision::selectTextFields.
testGetRevisionText_returnsDecompressedTextFieldWhenNotExternal( $row, $prefix, $expected)
provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal Revision::getRevisionText
overrideCommentStoreAndActorMigration()
Content object implementation for representing flat text.
testSelectUserFields()
Revision::selectUserFields.
testGetRevisionText( $expected, $rowData, $prefix='old_', $wiki=false)
Revision::getRevisionText provideGetRevisionText.
provideTestGetRevisionText_returnsDecompressedTextFieldWhenNotExternal()
testConstructFromArrayWithBadPageId()
Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray.
testGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts( $text)
provideTestGetRevisionText_external_returnsFalseWhenNotEnoughUrlParts Revision::getRevisionText
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
testConstructFromNothing()
Revision::__construct \MediaWiki\Storage\RevisionStore::newMutableRevisionFromArray.
testGetId( $rowArray, $expectedId)
provideGetId Revision::getId
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
testLoadFromTitle()
Revision::loadFromTitle.
static userJoinCond()
Return the value of a select() JOIN conds array for the user table.
testGetSha1_failure()
Revision::getSha1.
static factory( $code)
Get a cached or new language object for a given language code.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
const CONTENT_MODEL_JAVASCRIPT
static selectUserFields()
Return the list of user fields that should be selected from user table.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
static selectFields()
Return the list of revision fields that should be selected to create a new revision.
static decompressRevisionText( $text, $flags)
Re-converts revision text according to it's flags.
static loadFromTitle( $db, $title, $id=0)
Load either the current, or a specified, revision that's attached to a given page.
provideConstructFromRow()
getMockTitle( $model=CONTENT_MODEL_WIKITEXT)
testCompressRevisionTextUtf8()
Revision::compressRevisionText.
testGetRevisionWithZlibExtension( $expected, $rowData)
Revision::getRevisionText provideGetRevisionTextWithZlibExtension.
the array() calling protocol came about after MediaWiki 1.4rc1.
testGetParentId( $rowArray, $expected)
provideGetParentId Revision::getParentId()
Represents a page (or page fragment) title within MediaWiki.