Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / includes / api / ApiTokensTest.php
blobfbe97893d8102cae3f2da3af7b1c52f1c360882d
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( $user ) {
19 $tokens = $this->getTokenList( $user );
21 $rights = $user->user->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 );