wiki.techinc.nl/tests/phpunit/includes/api/ApiClearHasMsgTest.php
Alexander Vorwerk decbaf4f38 phpunit: use ->getServiceContainer() in integration tests
Change-Id: I38299cb65eeaadfdc0eb05db4e8c0b0119cfb37d
2022-01-27 22:04:16 +01:00

26 lines
723 B
PHP

<?php
/**
* @group API
* @group medium
* @covers ApiClearHasMsg
*/
class ApiClearHasMsgTest extends ApiTestCase {
/**
* Test clearing hasmsg flag for current user
*/
public function testClearFlag() {
$user = self::$users['sysop']->getUser();
$talkPageNotificationManager = $this->getServiceContainer()
->getTalkPageNotificationManager();
$talkPageNotificationManager->setUserHasNewMessages( $user );
$this->assertTrue( $talkPageNotificationManager->userHasNewMessages( $user ) );
$data = $this->doApiRequest( [ 'action' => 'clearhasmsg' ], [] );
$this->assertEquals( 'success', $data[0]['clearhasmsg'] );
$this->assertFalse( $talkPageNotificationManager->userHasNewMessages( $user ) );
}
}