MediaWiki  REL1_24
ApiTokensTest.php
Go to the documentation of this file.
00001 <?php
00002 
00010 class ApiTokensTest extends ApiTestCase {
00011 
00012     public function testGettingToken() {
00013         foreach ( self::$users as $user ) {
00014             $this->runTokenTest( $user );
00015         }
00016     }
00017 
00018     protected function runTokenTest( $user ) {
00019         $tokens = $this->getTokenList( $user );
00020 
00021         $rights = $user->user->getRights();
00022 
00023         $this->assertArrayHasKey( 'edittoken', $tokens );
00024         $this->assertArrayHasKey( 'movetoken', $tokens );
00025 
00026         if ( isset( $rights['delete'] ) ) {
00027             $this->assertArrayHasKey( 'deletetoken', $tokens );
00028         }
00029 
00030         if ( isset( $rights['block'] ) ) {
00031             $this->assertArrayHasKey( 'blocktoken', $tokens );
00032             $this->assertArrayHasKey( 'unblocktoken', $tokens );
00033         }
00034 
00035         if ( isset( $rights['protect'] ) ) {
00036             $this->assertArrayHasKey( 'protecttoken', $tokens );
00037         }
00038     }
00039 
00040 }