Move DatabaseDomain to Rdbms namespace
[mediawiki.git] / tests / phpunit / includes / api / ApiTokensTest.php
blob1f7c00b0a88e23617e627287cc2368474026e752
1 <?php
3 /**
4 * @group API
5 * @group Database
6 * @group medium
8 * @covers ApiTokens
9 */
10 class ApiTokensTest extends ApiTestCase {
12 public function testGettingToken() {
13 foreach ( self::$users as $user ) {
14 $this->runTokenTest( $user );
18 protected function runTokenTest( TestUser $user ) {
19 $tokens = $this->getTokenList( $user );
21 $rights = $user->getUser()->getRights();
23 $this->assertArrayHasKey( 'edittoken', $tokens );
24 $this->assertArrayHasKey( 'movetoken', $tokens );
26 if ( isset( $rights['delete'] ) ) {
27 $this->assertArrayHasKey( 'deletetoken', $tokens );
30 if ( isset( $rights['block'] ) ) {
31 $this->assertArrayHasKey( 'blocktoken', $tokens );
32 $this->assertArrayHasKey( 'unblocktoken', $tokens );
35 if ( isset( $rights['protect'] ) ) {
36 $this->assertArrayHasKey( 'protecttoken', $tokens );