From 5660bc91af39419c8fdb075a6a0a4e29c7248b0e Mon Sep 17 00:00:00 2001 From: addshore Date: Wed, 18 May 2016 12:08:47 +0100 Subject: [PATCH] Add ApiSetNotificationTimestampIntegrationTest Change-Id: If0bc1f56533102f54c0031eea548c20d8abe1818 --- ...etNotificationTimestampIntegrationTest.php | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 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 0000000000..ef4f5139e4 --- /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' ] ] + ); + } + +} -- 2.20.1