MediaWiki REL1_33
ApiSetNotificationTimestampIntegrationTest.php
Go to the documentation of this file.
1<?php
3
12
13 protected function setUp() {
14 parent::setUp();
15 self::$users[__CLASS__] = new TestUser( __CLASS__ );
16 }
17
18 public function testStuff() {
19 $user = self::$users[__CLASS__]->getUser();
20 $page = WikiPage::factory( Title::newFromText( 'UTPage' ) );
21
22 $user->addWatch( $page->getTitle() );
23
24 $result = $this->doApiRequestWithToken(
25 [
26 'action' => 'setnotificationtimestamp',
27 'timestamp' => '20160101020202',
28 'pageids' => $page->getId(),
29 ],
30 null,
31 $user
32 );
33
34 $this->assertEquals(
35 [
36 'batchcomplete' => true,
37 'setnotificationtimestamp' => [
38 [ 'ns' => 0, 'title' => 'UTPage', 'notificationtimestamp' => '2016-01-01T02:02:02Z' ]
39 ],
40 ],
41 $result[0]
42 );
43
44 $watchedItemStore = MediaWikiServices::getInstance()->getWatchedItemStore();
45 $this->assertEquals(
46 $watchedItemStore->getNotificationTimestampsBatch( $user, [ $page->getTitle() ] ),
47 [ [ 'UTPage' => '20160101020202' ] ]
48 );
49 }
50
51}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
doApiRequestWithToken(array $params, array $session=null, User $user=null, $tokenType='auto')
Convenience function to access the token parameter of doApiRequest() more succinctly.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Wraps the user object, so we can also retain full access to properties like password if we log in via...
Definition TestUser.php:9