Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / tests / phpunit / includes / api / ApiSetNotificationTimestampIntegrationTest.php
blobef4f5139e4ca4f9331855e975ba37a5122bdfcd1
1 <?php
2 use MediaWiki\MediaWikiServices;
4 /**
5 * @author Addshore
6 * @covers ApiSetNotificationTimestamp
7 * @group API
8 * @group medium
9 * @group Database
11 class ApiSetNotificationTimestampIntegrationTest extends ApiTestCase {
13 protected function setUp() {
14 parent::setUp();
15 self::$users[__CLASS__] = new TestUser( __CLASS__ );
16 $this->doLogin( __CLASS__ );
19 public function testStuff() {
20 $user = self::$users[__CLASS__]->getUser();
21 $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
23 $user->addWatch( $page->getTitle() );
25 $result = $this->doApiRequestWithToken(
27 'action' => 'setnotificationtimestamp',
28 'timestamp' => '20160101020202',
29 'pageids' => $page->getId(),
31 null,
32 $user
35 $this->assertEquals(
37 'batchcomplete' => true,
38 'setnotificationtimestamp' => [
39 [ 'ns' => 0, 'title' => 'UTPage', 'notificationtimestamp' => '2016-01-01T02:02:02Z' ]
42 $result[0]
45 $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
46 $this->assertEquals(
47 $watchedItemStore->getNotificationTimestampsBatch( $user, [ $page->getTitle() ] ),
48 [ [ 'UTPage' => '20160101020202' ] ]