16 parent::__construct(
$name, $data, $dataName );
18 $this->tablesUsed[] =
'recentchanges';
19 $this->tablesUsed[] =
'page';
25 self::$users[
'ApiQueryRecentChangesIntegrationTestUser'] = $this->
getMutableTestUser();
30 return self::$users[
'ApiQueryRecentChangesIntegrationTestUser']->getUser();
86 $page->doDeleteArticleReal( $reason );
99 foreach ( $editData
as $singleEditData ) {
100 if ( array_key_exists(
'minorEdit', $singleEditData ) && $singleEditData[
'minorEdit'] ) {
103 $singleEditData[
'target'],
104 $singleEditData[
'summary']
108 if ( array_key_exists(
'botEdit', $singleEditData ) && $singleEditData[
'botEdit'] ) {
111 $singleEditData[
'target'],
112 $singleEditData[
'summary']
118 $singleEditData[
'target'],
119 $singleEditData[
'summary']
127 [
'action' =>
'query',
'list' =>
'recentchanges' ],
139 [
'action' =>
'query',
'generator' =>
'recentchanges' ],
149 return $response[0][
'query'][
'recentchanges'];
155 MediaWikiServices::getInstance()->getGenderCache()
161 return $formatter->getPrefixedText( $target );
165 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
170 $this->assertArrayHasKey(
'query',
$result[0] );
171 $this->assertArrayHasKey(
'recentchanges',
$result[0][
'query'] );
174 $this->assertCount( 1, $items );
176 $this->assertArraySubset(
179 'ns' => $target->getNamespace(),
184 $this->assertArrayNotHasKey(
'bot', $item );
185 $this->assertArrayNotHasKey(
'new', $item );
186 $this->assertArrayNotHasKey(
'minor', $item );
187 $this->assertArrayHasKey(
'pageid', $item );
188 $this->assertArrayHasKey(
'revid', $item );
189 $this->assertArrayHasKey(
'old_revid', $item );
193 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
199 $this->assertCount( 1, $items );
200 $this->assertArrayHasKey(
'pageid', $items[0] );
201 $this->assertArrayHasKey(
'revid', $items[0] );
202 $this->assertArrayHasKey(
'old_revid', $items[0] );
203 $this->assertEquals(
'new', $items[0][
'type'] );
207 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
208 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
213 'target' => $subjectTarget,
214 'summary' =>
'Create the page',
217 'target' => $talkTarget,
218 'summary' =>
'Create Talk page',
229 'ns' => $talkTarget->getNamespace(),
234 'ns' => $subjectTarget->getNamespace(),
243 $normalEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
244 $minorEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPageM' );
245 $botEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPageB' );
250 'target' => $normalEditTarget,
251 'summary' =>
'Create the page',
254 'target' => $minorEditTarget,
255 'summary' =>
'Create the page',
258 'target' => $minorEditTarget,
259 'summary' =>
'Change content',
263 'target' => $botEditTarget,
264 'summary' =>
'Create the page with a bot',
304 $userEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
305 $anonEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPageA' );
329 $userEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
330 $anonEditTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPageA' );
345 'userid' =>
$user->getId(),
353 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
362 'comment' =>
'Create the <b>page</b>',
370 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
379 'parsedcomment' =>
'Create the <b>page</b>',
387 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
393 $this->assertCount( 1, $items );
394 $this->assertArrayHasKey(
'timestamp', $items[0] );
395 $this->assertInternalType(
'string', $items[0][
'timestamp'] );
399 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
419 'Create the page that will be deleted'
421 $this->
deletePage( $target,
'Important Reason' );
425 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
431 $this->assertCount( 1, $items );
432 $this->assertArraySubset(
435 'logtype' =>
'delete',
436 'logaction' =>
'delete',
441 $this->assertArrayHasKey(
'logid', $items[0] );
446 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
462 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
463 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
468 'target' => $subjectTarget,
469 'summary' =>
'Create the page',
472 'target' => $talkTarget,
473 'summary' =>
'Create the talk page',
481 $this->assertCount( 1, $items );
482 $this->assertArraySubset(
492 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
505 $this->assertCount( 1, $items );
506 $this->assertArraySubset( [
'anon' =>
true ], $items[0] );
511 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
512 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
517 'target' => $subjectTarget,
518 'summary' =>
'Create the page',
521 'target' => $subjectTarget,
522 'summary' =>
'Change the content',
525 'target' => $talkTarget,
526 'summary' =>
'Create Talk page',
538 'ns' => $talkTarget->getNamespace(),
543 'ns' => $subjectTarget->getNamespace(),
553 'ns' => $subjectTarget->getNamespace(),
562 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
563 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
573 'ns' => $subjectTarget->getNamespace(),
588 'rc_namespace' =>
$title->getNamespace(),
589 'rc_title' =>
$title->getDBkey(),
591 'rc_source' =>
'foo',
593 'rc_cur_id' =>
$title->getArticleID(),
595 'rc_user_text' =>
'm>External User',
597 'rc_comment_text' =>
'',
598 'rc_comment_data' =>
null,
599 'rc_this_oldid' =>
$title->getLatestRevID(),
600 'rc_last_oldid' =>
$title->getLatestRevID(),
605 'rc_old_len' =>
$title->getLength(),
606 'rc_new_len' =>
$title->getLength(),
609 'rc_log_type' =>
null,
610 'rc_log_action' =>
'',
614 'prefixedDBkey' =>
$title->getPrefixedDBkey(),
615 'lastTimestamp' => 0,
616 'oldSize' =>
$title->getLength(),
617 'newSize' =>
$title->getLength(),
618 'pageStatus' =>
'changed'
626 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
627 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
639 'type' =>
'external',
640 'ns' => $subjectTarget->getNamespace(),
650 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
656 'target' => $categoryTarget,
657 'summary' =>
'Create the category',
660 'target' => $subjectTarget,
661 'summary' =>
'Create the page and add it to the category',
669 $revision->getTimestamp(),
672 $revision->getComment(),
686 'type' =>
'categorize',
687 'ns' => $categoryTarget->getNamespace(),
696 $target1 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
697 $target2 =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
698 $target3 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage2' );
703 'target' => $target1,
704 'summary' =>
'Create the page',
707 'target' => $target2,
708 'summary' =>
'Create Talk page',
711 'target' => $target3,
712 'summary' =>
'Create the page',
724 'ns' => $target3->getNamespace(),
729 'ns' => $target2->getNamespace(),
734 'ns' => $target1->getNamespace(),
744 'ns' => $target3->getNamespace(),
749 'ns' => $target2->getNamespace(),
755 $this->assertArrayHasKey(
'continue', $resultWithLimit[0] );
756 $this->assertArrayHasKey(
'rccontinue', $resultWithLimit[0][
'continue'] );
760 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
766 'summary' =>
'Create the page',
770 'summary' =>
'Change the content',
782 'ns' => $target->getNamespace(),
787 'ns' => $target->getNamespace(),
797 'ns' => $target->getNamespace(),
802 'ns' => $target->getNamespace(),
811 $subjectTarget =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
812 $talkTarget =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
817 'target' => $subjectTarget,
818 'summary' =>
'Create the page',
821 'target' => $talkTarget,
822 'summary' =>
'Create Talk page',
828 [
'rcdir' =>
'older',
'rcprop' =>
'title' ]
831 [
'rcdir' =>
'newer',
'rcprop' =>
'title' ]
838 'ns' => $talkTarget->getNamespace(),
843 'ns' => $subjectTarget->getNamespace(),
853 'ns' => $subjectTarget->getNamespace(),
858 'ns' => $talkTarget->getNamespace(),
867 $page1 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
868 $page2 =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage2' );
869 $page3 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage3' );
875 'summary' =>
'Create the page',
879 'summary' =>
'Create the page',
883 'summary' =>
'Create the page',
890 'rctitle' =>
'ApiQueryRecentChangesIntegrationTestPage',
897 'rctitle' =>
'Talk:ApiQueryRecentChangesIntegrationTestPage2',
906 'ns' => $page1->getNamespace(),
917 'ns' => $page2->getNamespace(),
926 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
930 'rcstart' =>
'20010115000000',
935 'rcend' =>
'20010115000000',
944 'ns' => $target->getNamespace(),
954 $target1 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
955 $target2 =
new TitleValue( 1,
'ApiQueryRecentChangesIntegrationTestPage' );
956 $target3 =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage2' );
961 'target' => $target1,
962 'summary' =>
'Create the page',
965 'target' => $target2,
966 'summary' =>
'Create Talk page',
969 'target' => $target3,
970 'summary' =>
'Create the page',
976 $this->assertArrayHasKey(
'continue', $firstResult[0] );
977 $this->assertArrayHasKey(
'rccontinue', $firstResult[0][
'continue'] );
979 $continuationParam = $firstResult[0][
'continue'][
'rccontinue'];
982 [
'rccontinue' => $continuationParam,
'rcprop' =>
'title' ]
989 'ns' => $target3->getNamespace(),
994 'ns' => $target2->getNamespace(),
1000 $this->assertEquals(
1004 'ns' => $target1->getNamespace(),
1013 $target =
new TitleValue( 0,
'ApiQueryRecentChangesIntegrationTestPage' );
1018 $this->assertArrayHasKey(
'query',
$result[0] );
1019 $this->assertArrayHasKey(
'pages',
$result[0][
'query'] );
1022 $pages = array_values(
$result[0][
'query'][
'pages'] );
1024 $this->assertCount( 1, $pages );
1025 $this->assertArraySubset(
1027 'ns' => $target->getNamespace(),