17 parent::__construct( $name, $data, $dataName );
18 $this->tablesUsed = array_unique(
19 array_merge( $this->tablesUsed, [
'watchlist',
'recentchanges',
'page' ] )
30 return self::$users[
'ApiQueryWatchlistIntegrationTestUser']->getUser();
34 return self::$users[
'ApiQueryWatchlistIntegrationTestUser2']->getUser();
38 $title = Title::newFromLinkTarget( $target );
39 $page = WikiPage::factory( $title );
41 ContentHandler::makeContent(
$content, $title ),
50 $title = Title::newFromLinkTarget( $target );
51 $page = WikiPage::factory( $title );
53 ContentHandler::makeContent(
$content, $title ),
62 $title = Title::newFromLinkTarget( $target );
63 $page = WikiPage::factory( $title );
65 ContentHandler::makeContent(
$content, $title ),
74 $title = Title::newFromLinkTarget( $target );
75 $page = WikiPage::factory( $title );
77 ContentHandler::makeContent(
$content, $title ),
92 $title = Title::newFromLinkTarget( $target );
93 $summary = CommentStoreComment::newUnsavedComment( trim( $summary ) );
94 $page = WikiPage::factory( $title );
96 $updater = $page->newPageUpdater( $user );
97 $updater->setContent( SlotRecord::MAIN, ContentHandler::makeContent(
$content, $title ) );
100 $rc = MediaWikiServices::getInstance()->getRevisionStore()->getRecentChange(
$rev );
101 $rc->doMarkPatrolled( $patrollingUser,
false, [] );
105 $title = Title::newFromLinkTarget( $target );
106 $page = WikiPage::factory( $title );
107 $page->doDeleteArticleReal( $reason );
121 foreach ( $editData as $singleEditData ) {
122 if ( array_key_exists(
'minorEdit', $singleEditData ) && $singleEditData[
'minorEdit'] ) {
125 $singleEditData[
'target'],
126 $singleEditData[
'content'],
127 $singleEditData[
'summary']
131 if ( array_key_exists(
'botEdit', $singleEditData ) && $singleEditData[
'botEdit'] ) {
134 $singleEditData[
'target'],
135 $singleEditData[
'content'],
136 $singleEditData[
'summary']
142 $singleEditData[
'target'],
143 $singleEditData[
'content'],
144 $singleEditData[
'summary']
150 return MediaWikiServices::getInstance()->getWatchedItemStore();
159 $store->addWatchBatchForUser( $user, $targets );
163 if ( $user ===
null ) {
168 [
'action' =>
'query',
'list' =>
'watchlist' ],
170 ),
null,
false, $user
177 [
'action' =>
'query',
'generator' =>
'watchlist' ],
184 return $response[0][
'query'][
'watchlist'];
205 array $expectedItems,
206 array $keysUsedInValueComparison,
207 array $requiredKeys = []
209 $this->assertCount( count( $expectedItems ), $actualItems );
212 $actualItemsOnlyComparedValues = array_map(
213 function (
array $item ) use ( $keysUsedInValueComparison ) {
214 return array_intersect_key( $item, array_flip( $keysUsedInValueComparison ) );
221 $actualItemsOnlyComparedValues
225 $actualItemsKeysOnly = array_map(
'array_keys', $actualItems );
226 foreach ( $actualItemsKeysOnly as $keysOfTheItem ) {
227 $this->assertEmpty( array_diff( $requiredKeys, $keysOfTheItem ) );
233 Language::factory(
'en' ),
234 MediaWikiServices::getInstance()->getGenderCache()
240 return $formatter->getPrefixedText( $target );
246 $items = $store->getWatchedItemsForUser( $user );
247 foreach ( $items as $item ) {
248 $store->removeWatch( $user, $item->getLinkTarget() );
258 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
269 $this->assertArrayHasKey(
'query', $result[0] );
270 $this->assertArrayHasKey(
'watchlist', $result[0][
'query'] );
277 'ns' => $target->getNamespace(),
278 'title' => $this->getPrefixedText( $target ),
284 [
'type',
'ns',
'title',
'bot',
'new',
'minor' ],
285 [
'pageid',
'revid',
'old_revid' ]
291 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
303 $this->assertCount( 1, $items );
304 $this->assertArrayHasKey(
'pageid', $items[0] );
305 $this->assertArrayHasKey(
'revid', $items[0] );
306 $this->assertArrayHasKey(
'old_revid', $items[0] );
307 $this->assertEquals(
'new', $items[0][
'type'] );
312 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
313 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
318 'target' => $subjectTarget,
319 'content' =>
'Some Content',
320 'summary' =>
'Create the page',
323 'target' => $talkTarget,
324 'content' =>
'Some Talk Page Content',
325 'summary' =>
'Create Talk page',
329 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
337 'ns' => $talkTarget->getNamespace(),
338 'title' => $this->getPrefixedText( $talkTarget ),
342 'ns' => $subjectTarget->getNamespace(),
343 'title' => $this->getPrefixedText( $subjectTarget ),
346 $this->getItemsFromApiResponse( $result )
352 $normalEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
353 $minorEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPageM' );
354 $botEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPageB' );
359 'target' => $normalEditTarget,
360 'content' =>
'Some Content',
361 'summary' =>
'Create the page',
364 'target' => $minorEditTarget,
365 'content' =>
'Some Content',
366 'summary' =>
'Create the page',
369 'target' => $minorEditTarget,
370 'content' =>
'Slightly Better Content',
371 'summary' =>
'Change content',
375 'target' => $botEditTarget,
376 'content' =>
'Some Content',
377 'summary' =>
'Create the page with a bot',
382 $this->
watchPages( $user, [ $normalEditTarget, $minorEditTarget, $botEditTarget ] );
413 $userEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
414 $anonEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPageA' );
426 $this->
watchPages( $user, [ $userEditTarget, $anonEditTarget ] );
439 'user' => $user->getName(),
442 $this->getItemsFromApiResponse( $result )
448 $userEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
449 $anonEditTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPageA' );
461 $this->
watchPages( $user, [ $userEditTarget, $anonEditTarget ] );
475 'user' => $user->getId(),
476 'userid' => $user->getId(),
479 $this->getItemsFromApiResponse( $result )
485 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
490 'Create the <b>page</b>'
500 'comment' =>
'Create the <b>page</b>',
509 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
514 'Create the <b>page</b>'
524 'parsedcomment' =>
'Create the <b>page</b>',
533 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
545 $this->assertCount( 1, $items );
546 $this->assertArrayHasKey(
'timestamp', $items[0] );
547 $this->assertInternalType(
'string', $items[0][
'timestamp'] );
552 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
577 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
586 $store->updateNotificationTimestamp(
598 'notificationtimestamp' =>
'2015-12-12T01:01:01Z',
606 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
612 'Create the page (this gets patrolled)',
620 $testUser = static::getTestSysop();
621 $user = $testUser->getUser();
631 'unpatrolled' =>
false,
632 'autopatrolled' =>
false,
644 'Create the page that will be deleted'
646 $this->
deletePage( $target,
'Important Reason' );
650 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
662 'logtype' =>
'delete',
663 'logaction' =>
'delete',
667 [
'type',
'logtype',
'logaction',
'logparams' ],
674 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
697 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
698 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
703 'target' => $subjectTarget,
704 'content' =>
'Some Content',
705 'summary' =>
'Create the page',
708 'target' => $talkTarget,
709 'content' =>
'Some Content',
710 'summary' =>
'Create the talk page',
714 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
733 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
734 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
744 'What is this page about?',
745 'Create the talk page'
747 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
750 'wlprop' =>
'user|title',
751 'wluser' => $otherUser->getName(),
758 'ns' => $talkTarget->getNamespace(),
759 'title' => $this->getPrefixedText( $talkTarget ),
760 'user' => $otherUser->getName(),
763 $this->getItemsFromApiResponse( $result )
770 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
771 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
781 'What is this page about?',
782 'Create the talk page'
784 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
787 'wlprop' =>
'user|title',
788 'wlexcludeuser' => $otherUser->getName(),
795 'ns' => $subjectTarget->getNamespace(),
796 'title' => $this->getPrefixedText( $subjectTarget ),
797 'user' => $user->getName(),
800 $this->getItemsFromApiResponse( $result )
806 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
812 'content' =>
'Some Content',
813 'summary' =>
'Create the page',
817 'content' =>
'Slightly Better Content',
818 'summary' =>
'Change content',
826 'wlshow' => WatchedItemQueryService::FILTER_MINOR,
830 'wlshow' => WatchedItemQueryService::FILTER_NOT_MINOR,
'wlprop' =>
'flags'
845 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
855 'wlshow' => WatchedItemQueryService::FILTER_BOT
858 'wlshow' => WatchedItemQueryService::FILTER_NOT_BOT
873 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
883 'wlshow' => WatchedItemQueryService::FILTER_ANON
887 'wlshow' => WatchedItemQueryService::FILTER_NOT_ANON
903 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
904 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
915 'Create the talk page'
918 $store->addWatchBatchForUser( $user, [ $subjectTarget, $talkTarget ] );
919 $store->updateNotificationTimestamp(
926 'wlprop' =>
'notificationtimestamp|title',
927 'wlshow' => WatchedItemQueryService::FILTER_UNREAD
930 'wlprop' =>
'notificationtimestamp|title',
931 'wlshow' => WatchedItemQueryService::FILTER_NOT_UNREAD
938 'notificationtimestamp' =>
'2015-12-12T01:01:01Z',
939 'ns' => $talkTarget->getNamespace(),
940 'title' => $this->getPrefixedText( $talkTarget )
943 $this->getItemsFromApiResponse( $resultUnread )
949 'notificationtimestamp' =>
'',
950 'ns' => $subjectTarget->getNamespace(),
951 'title' => $this->getPrefixedText( $subjectTarget )
954 $this->getItemsFromApiResponse( $resultNotUnread )
959 $user = static::getTestSysop()->getUser();
963 'wlprop' =>
'patrol',
964 'wlshow' => WatchedItemQueryService::FILTER_PATROLLED
967 'wlprop' =>
'patrol',
968 'wlshow' => WatchedItemQueryService::FILTER_NOT_PATROLLED
976 'unpatrolled' =>
false,
977 'autopatrolled' =>
false,
987 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
988 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
993 'target' => $subjectTarget,
994 'content' =>
'Some Content',
995 'summary' =>
'Create the page',
998 'target' => $subjectTarget,
999 'content' =>
'Some Other Content',
1000 'summary' =>
'Change the content',
1003 'target' => $talkTarget,
1004 'content' =>
'Some Talk Page Content',
1005 'summary' =>
'Create Talk page',
1009 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
1014 $this->assertEquals(
1018 'ns' => $talkTarget->getNamespace(),
1019 'title' => $this->getPrefixedText( $talkTarget ),
1022 $this->getItemsFromApiResponse( $resultNew )
1024 $this->assertEquals(
1028 'ns' => $subjectTarget->getNamespace(),
1029 'title' => $this->getPrefixedText( $subjectTarget ),
1032 $this->getItemsFromApiResponse( $resultEdit )
1038 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1039 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
1044 'Some Talk Page Content',
1047 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
1051 $this->assertEquals(
1055 'ns' => $subjectTarget->getNamespace(),
1056 'title' => $this->getPrefixedText( $subjectTarget ),
1059 $this->getItemsFromApiResponse( $result )
1064 $title = Title::newFromLinkTarget( $target );
1070 'rc_namespace' => $title->getNamespace(),
1071 'rc_title' => $title->getDBkey(),
1073 'rc_source' =>
'foo',
1075 'rc_cur_id' => $title->getArticleID(),
1077 'rc_user_text' =>
'ext>External User',
1079 'rc_comment_text' =>
'',
1080 'rc_comment_data' =>
null,
1081 'rc_this_oldid' => $title->getLatestRevID(),
1082 'rc_last_oldid' => $title->getLatestRevID(),
1085 'rc_patrolled' => 0,
1087 'rc_old_len' => $title->getLength(),
1088 'rc_new_len' => $title->getLength(),
1091 'rc_log_type' =>
null,
1092 'rc_log_action' =>
'',
1096 'prefixedDBkey' => $title->getPrefixedDBkey(),
1097 'lastTimestamp' => 0,
1098 'oldSize' => $title->getLength(),
1099 'newSize' => $title->getLength(),
1100 'pageStatus' =>
'changed'
1108 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1109 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
1119 'Some Talk Page Content',
1126 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
1130 $this->assertEquals(
1133 'type' =>
'external',
1134 'ns' => $subjectTarget->getNamespace(),
1135 'title' => $this->getPrefixedText( $subjectTarget ),
1138 $this->getItemsFromApiResponse( $result )
1144 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1150 'target' => $categoryTarget,
1151 'content' =>
'Some Content',
1152 'summary' =>
'Create the category',
1155 'target' => $subjectTarget,
1156 'content' =>
'Some Content [[Category:ApiQueryWatchlistIntegrationTestCategory]]t',
1157 'summary' =>
'Create the page and add it to the category',
1161 $title = Title::newFromLinkTarget( $subjectTarget );
1164 $rc = RecentChange::newForCategorization(
1165 $revision->getTimestamp(),
1166 Title::newFromLinkTarget( $categoryTarget ),
1168 $revision->getComment(),
1177 $this->
watchPages( $user, [ $subjectTarget, $categoryTarget ] );
1181 $this->assertEquals(
1184 'type' =>
'categorize',
1185 'ns' => $categoryTarget->getNamespace(),
1186 'title' => $this->getPrefixedText( $categoryTarget ),
1189 $this->getItemsFromApiResponse( $result )
1195 $target1 =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1196 $target2 =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
1197 $target3 =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage2' );
1202 'target' => $target1,
1203 'content' =>
'Some Content',
1204 'summary' =>
'Create the page',
1207 'target' => $target2,
1208 'content' =>
'Some Talk Page Content',
1209 'summary' =>
'Create Talk page',
1212 'target' => $target3,
1213 'content' =>
'Some Other Content',
1214 'summary' =>
'Create the page',
1218 $this->
watchPages( $user, [ $target1, $target2, $target3 ] );
1223 $this->assertEquals(
1227 'ns' => $target3->getNamespace(),
1228 'title' => $this->getPrefixedText( $target3 )
1232 'ns' => $target2->getNamespace(),
1233 'title' => $this->getPrefixedText( $target2 )
1237 'ns' => $target1->getNamespace(),
1238 'title' => $this->getPrefixedText( $target1 )
1241 $this->getItemsFromApiResponse( $resultWithoutLimit )
1243 $this->assertEquals(
1247 'ns' => $target3->getNamespace(),
1248 'title' => $this->getPrefixedText( $target3 )
1252 'ns' => $target2->getNamespace(),
1253 'title' => $this->getPrefixedText( $target2 )
1256 $this->getItemsFromApiResponse( $resultWithLimit )
1258 $this->assertArrayHasKey(
'continue', $resultWithLimit[0] );
1259 $this->assertArrayHasKey(
'wlcontinue', $resultWithLimit[0][
'continue'] );
1264 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1269 'target' => $target,
1270 'content' =>
'Some Content',
1271 'summary' =>
'Create the page',
1274 'target' => $target,
1275 'content' =>
'Some Other Content',
1276 'summary' =>
'Change the content',
1285 $this->assertEquals(
1289 'ns' => $target->getNamespace(),
1290 'title' => $this->getPrefixedText( $target ),
1293 $this->getItemsFromApiResponse( $resultNoAllRev )
1295 $this->assertEquals(
1299 'ns' => $target->getNamespace(),
1300 'title' => $this->getPrefixedText( $target ),
1304 'ns' => $target->getNamespace(),
1305 'title' => $this->getPrefixedText( $target ),
1308 $this->getItemsFromApiResponse( $resultAllRev )
1314 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1315 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
1320 'target' => $subjectTarget,
1321 'content' =>
'Some Content',
1322 'summary' =>
'Create the page',
1325 'target' => $talkTarget,
1326 'content' =>
'Some Talk Page Content',
1327 'summary' =>
'Create Talk page',
1331 $this->
watchPages( $user, [ $subjectTarget, $talkTarget ] );
1336 $this->assertEquals(
1340 'ns' => $talkTarget->getNamespace(),
1341 'title' => $this->getPrefixedText( $talkTarget )
1345 'ns' => $subjectTarget->getNamespace(),
1346 'title' => $this->getPrefixedText( $subjectTarget )
1349 $this->getItemsFromApiResponse( $resultDirOlder )
1351 $this->assertEquals(
1355 'ns' => $subjectTarget->getNamespace(),
1356 'title' => $this->getPrefixedText( $subjectTarget )
1360 'ns' => $talkTarget->getNamespace(),
1361 'title' => $this->getPrefixedText( $talkTarget )
1364 $this->getItemsFromApiResponse( $resultDirNewer )
1370 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1380 'wlstart' =>
'20010115000000',
1382 'wlprop' =>
'title',
1385 'wlend' =>
'20010115000000',
1387 'wlprop' =>
'title',
1390 $this->assertEquals(
1394 'ns' => $target->getNamespace(),
1395 'title' => $this->getPrefixedText( $target ),
1398 $this->getItemsFromApiResponse( $resultStart )
1405 $target1 =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1406 $target2 =
new TitleValue( 1,
'ApiQueryWatchlistIntegrationTestPage' );
1407 $target3 =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage2' );
1412 'target' => $target1,
1413 'content' =>
'Some Content',
1414 'summary' =>
'Create the page',
1417 'target' => $target2,
1418 'content' =>
'Some Talk Page Content',
1419 'summary' =>
'Create Talk page',
1422 'target' => $target3,
1423 'content' =>
'Some Other Content',
1424 'summary' =>
'Create the page',
1428 $this->
watchPages( $user, [ $target1, $target2, $target3 ] );
1431 $this->assertArrayHasKey(
'continue', $firstResult[0] );
1432 $this->assertArrayHasKey(
'wlcontinue', $firstResult[0][
'continue'] );
1434 $continuationParam = $firstResult[0][
'continue'][
'wlcontinue'];
1437 [
'wlcontinue' => $continuationParam,
'wlprop' =>
'title' ]
1440 $this->assertEquals(
1444 'ns' => $target3->getNamespace(),
1445 'title' => $this->getPrefixedText( $target3 ),
1449 'ns' => $target2->getNamespace(),
1450 'title' => $this->getPrefixedText( $target2 ),
1453 $this->getItemsFromApiResponse( $firstResult )
1455 $this->assertEquals(
1459 'ns' => $target1->getNamespace(),
1460 'title' => $this->getPrefixedText( $target1 )
1463 $this->getItemsFromApiResponse( $continuedResult )
1468 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1477 $otherUser->setOption(
'watchlisttoken',
'1234567890' );
1478 $otherUser->saveSettings();
1480 $this->
watchPages( $otherUser, [ $target ] );
1483 $this->assertEquals(
'1234567890', $reloadedUser->getOption(
'watchlisttoken' ) );
1486 'wlowner' => $otherUser->getName(),
1487 'wltoken' =>
'1234567890',
1488 'wlprop' =>
'title',
1491 $this->assertEquals(
1495 'ns' => $target->getNamespace(),
1496 'title' => $this->getPrefixedText( $target )
1499 $this->getItemsFromApiResponse( $result )
1505 $otherUser->setOption(
'watchlisttoken',
'1234567890' );
1506 $otherUser->saveSettings();
1508 $this->setExpectedException( ApiUsageException::class,
'Incorrect watchlist token provided' );
1511 'wlowner' => $otherUser->getName(),
1512 'wltoken' =>
'wrong-token',
1517 $this->setExpectedException( ApiUsageException::class,
'Incorrect watchlist token provided' );
1521 'wltoken' =>
'some-token',
1527 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1538 $this->assertArrayHasKey(
'query', $result[0] );
1539 $this->assertArrayHasKey(
'pages', $result[0][
'query'] );
1542 $pages = array_values( $result[0][
'query'][
'pages'] );
1548 'ns' => $target->getNamespace(),
1549 'title' => $this->getPrefixedText( $target ),
1553 [
'ns',
'title',
'new' ]
1559 $target =
new TitleValue( 0,
'ApiQueryWatchlistIntegrationTestPage' );
1564 'target' => $target,
1565 'content' =>
'Some Content',
1566 'summary' =>
'Create the page',
1569 'target' => $target,
1570 'content' =>
'Some Other Content',
1571 'summary' =>
'Change the content',
1579 $this->assertArrayHasKey(
'query', $result[0] );
1580 $this->assertArrayHasKey(
'pages', $result[0][
'query'] );
1583 $pages = array_values( $result[0][
'query'][
'pages'] );
1585 $this->assertCount( 1, $pages );
1586 $this->assertEquals( 0, $pages[0][
'ns'] );
1587 $this->assertEquals( $this->
getPrefixedText( $target ), $pages[0][
'title'] );
1589 $pages[0][
'revisions'],
1592 'comment' =>
'Create the page',
1593 'user' => $user->getName(),
1597 'comment' =>
'Change the content',
1598 'user' => $user->getName(),
1602 [
'comment',
'user',
'minor' ]
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
testExternalTypeParameters()
testUserIdPropParameter()
testCommentPropParameter()
setupPatrolledSpecificFixtures(User $user)
watchPages(User $user, array $targets)
testParsedCommentPropParameter()
testShowPatrolledParams()
assertArraySubsetsEqual(array $actualItems, array $expectedItems, array $keysUsedInValueComparison, array $requiredKeys=[])
Convenience method to assert that actual items array fetched from API is equal to the expected array,...
testOwnerAndTokenParams_wrongToken()
doPageEdits(User $user, array $editData)
Performs a batch of page edits as a specified user.
testLoginfoPropParameter()
cleanTestUsersWatchlist()
testListWatchlist_returnsWatchedItemsWithRCInfo()
testOwnerAndTokenParams_noWatchlistTokenSet()
testOwnerAndTokenParams()
testCategorizeTypeParameter()
doPatrolledPageEdit(User $user, LinkTarget $target, $content, $summary, User $patrollingUser)
doBotPageEdit(User $user, LinkTarget $target, $content, $summary)
deletePage(LinkTarget $target, $reason)
testPatrolPropParameter()
doMinorPageEdit(User $user, LinkTarget $target, $content, $summary)
testGeneratorWatchlistPropInfo_returnsWatchedPages()
__construct( $name=null, array $data=[], $dataName='')
getExternalRC(LinkTarget $target)
doAnonPageEdit(LinkTarget $target, $content, $summary)
getPrefixedText(LinkTarget $target)
createPageAndDeleteIt(LinkTarget $target)
doGeneratorWatchlistRequest(array $params=[])
testNewAndEditTypeParameters()
testTimestampPropParameter()
testGeneratorWatchlistPropRevisions_returnsWatchedItemsRevisions()
getItemsFromApiResponse(array $response)
doListWatchlistRequest(array $params=[], $user=null)
testNotificationTimestampPropParameter()
doPageEdit(User $user, LinkTarget $target, $content, $summary)
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.
Utility class for creating new RC entries.
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
Represents a page (or page fragment) title within MediaWiki.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
static newFromId( $id)
Static factory method for creation from a given user ID.
namespace and then decline to actually register it file or subcat img or subcat $title
this hook is for auditing only $response
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
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
$page->newPageUpdater($user) $updater