diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php b/www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php new file mode 100644 index 00000000..dacd48f6 --- /dev/null +++ b/www/wiki/tests/phpunit/includes/api/ApiSetNotificationTimestampIntegrationTest.php @@ -0,0 +1,51 @@ +<?php +use MediaWiki\MediaWikiServices; + +/** + * @author Addshore + * @covers ApiSetNotificationTimestamp + * @group API + * @group medium + * @group Database + */ +class ApiSetNotificationTimestampIntegrationTest extends ApiTestCase { + + protected function setUp() { + parent::setUp(); + self::$users[__CLASS__] = new TestUser( __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' ] ] + ); + } + +} |