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 );