16 self::$users[
'ApiQueryWatchlistRawIntegrationTestUser']
18 self::$users[
'ApiQueryWatchlistRawIntegrationTestUser2']
20 $this->
doLogin(
'ApiQueryWatchlistRawIntegrationTestUser' );
24 return self::$users[
'ApiQueryWatchlistRawIntegrationTestUser']->getUser();
28 return self::$users[
'ApiQueryWatchlistRawIntegrationTestUser2']->getUser();
32 return MediaWikiServices::getInstance()->getWatchedItemStore();
37 [
'action' =>
'query',
'list' =>
'watchlistraw' ],
44 [
'action' =>
'query',
'generator' =>
'watchlistraw' ],
57 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage' )
62 $this->assertArrayHasKey(
'watchlistraw',
$result[0] );
68 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage',
76 $target =
new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage' );
82 $store->updateNotificationTimestamp(
94 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage',
95 'changed' =>
'2015-12-12T01:01:01Z',
106 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage' ),
107 new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage' ),
116 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage',
124 $subjectTarget =
new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage' );
125 $talkTarget =
new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage' );
134 $store->updateNotificationTimestamp(
151 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage',
152 'changed' =>
'2015-12-12T01:01:01Z',
162 'title' =>
'Talk:ApiQueryWatchlistRawIntegrationTestPage',
173 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
174 new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
175 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
185 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
189 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
193 'title' =>
'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
202 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
206 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
212 $this->assertArrayNotHasKey(
'continue', $resultWithoutLimit[0] );
213 $this->assertArrayHasKey(
'continue', $resultWithLimit[0] );
214 $this->assertArrayHasKey(
'wrcontinue', $resultWithLimit[0][
'continue'] );
221 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
222 new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
223 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
233 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
237 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
241 'title' =>
'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
251 'title' =>
'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
255 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
259 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
270 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
271 new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
272 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
288 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
289 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
290 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage3' ),
294 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
301 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
305 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage3',
316 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
317 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
318 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage3' ),
322 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
329 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
333 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
344 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
345 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
346 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage3' ),
350 $continuationParam = $firstResult[0][
'continue'][
'wrcontinue'];
352 $this->assertEquals(
'0|ApiQueryWatchlistRawIntegrationTestPage3', $continuationParam );
360 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage3',
371 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
372 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
375 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1' ],
376 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2' ],
381 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
382 'wrcontinue' =>
'0|ApiQueryWatchlistRawIntegrationTestPage3',
385 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage3' ],
390 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage3',
391 'wrcontinue' =>
'0|ApiQueryWatchlistRawIntegrationTestPage2',
394 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage2' ],
395 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage3' ],
400 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
401 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage3',
402 'wrcontinue' =>
'0|ApiQueryWatchlistRawIntegrationTestPage3',
405 [
'ns' => 0,
'title' =>
'ApiQueryWatchlistRawIntegrationTestPage3' ],
418 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
419 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
420 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage3' ),
432 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
433 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
438 'wrfromtitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
439 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage2',
440 'wrdir' =>
'descending',
445 'wrtotitle' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
446 'wrcontinue' =>
'0|ApiQueryWatchlistRawIntegrationTestPage2',
459 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
460 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage2' ),
466 $this->assertArrayNotHasKey(
'continue',
$result[0] );
471 $otherUser->setOption(
'watchlisttoken',
'1234567890' );
472 $otherUser->saveSettings();
475 $store->addWatchBatchForUser( $otherUser, [
476 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
477 new TitleValue( 1,
'ApiQueryWatchlistRawIntegrationTestPage1' ),
482 'wrowner' => $otherUser->getName(),
483 'wrtoken' =>
'1234567890',
490 'title' =>
'ApiQueryWatchlistRawIntegrationTestPage1',
494 'title' =>
'Talk:ApiQueryWatchlistRawIntegrationTestPage1',
503 $otherUser->setOption(
'watchlisttoken',
'1234567890' );
504 $otherUser->saveSettings();
509 'wrowner' => $otherUser->getName(),
510 'wrtoken' =>
'wrong-token',
519 'wrtoken' =>
'some-watchlist-token',
527 new TitleValue( 0,
'ApiQueryWatchlistRawIntegrationTestPage' )
532 $this->assertArrayHasKey(
'query',
$result[0] );
533 $this->assertArrayHasKey(
'pages',
$result[0][
'query'] );
534 $this->assertCount( 1,
$result[0][
'query'][
'pages'] );
537 $item = array_values(
$result[0][
'query'][
'pages'] )[0];
539 $this->assertEquals( 0, $item[
'ns'] );
540 $this->assertEquals(
'ApiQueryWatchlistRawIntegrationTestPage', $item[
'title'] );