X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php diff --git a/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php b/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php new file mode 100644 index 00000000..ef4f5139 --- /dev/null +++ b/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php @@ -0,0 +1,52 @@ +doLogin( __CLASS__ ); + } + + public function testStuff() { + $user = self::$users[__CLASS__]->getUser(); + $page = WikiPage::factory( Title::newFromText( 'UTPage' ) ); + + $user->addWatch( $page->getTitle() ); + + $result = $this->doApiRequestWithToken( + [ + 'action' => 'setnotificationtimestamp', + 'timestamp' => '20160101020202', + 'pageids' => $page->getId(), + ], + null, + $user + ); + + $this->assertEquals( + [ + 'batchcomplete' => true, + 'setnotificationtimestamp' => [ + [ 'ns' => 0, 'title' => 'UTPage', 'notificationtimestamp' => '2016-01-01T02:02:02Z' ] + ], + ], + $result[0] + ); + + $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore(); + $this->assertEquals( + $watchedItemStore->getNotificationTimestampsBatch( $user, [ $page->getTitle() ] ), + [ [ 'UTPage' => '20160101020202' ] ] + ); + } + +}