2016-05-18 11:08:47 +00:00
|
|
|
<?php
|
2019-05-28 14:04:23 +00:00
|
|
|
|
2016-05-18 11:08:47 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author Addshore
|
|
|
|
|
* @covers ApiSetNotificationTimestamp
|
|
|
|
|
* @group API
|
|
|
|
|
* @group medium
|
|
|
|
|
* @group Database
|
|
|
|
|
*/
|
|
|
|
|
class ApiSetNotificationTimestampIntegrationTest extends ApiTestCase {
|
|
|
|
|
|
|
|
|
|
public function testStuff() {
|
2021-01-21 02:47:22 +00:00
|
|
|
$user = $this->getTestUser()->getUser();
|
2016-05-18 11:08:47 +00:00
|
|
|
$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' ] ]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|