MediaWiki REL1_31
ApiTokensTest.php
Go to the documentation of this file.
1<?php
2
11
12 public function testGettingToken() {
13 foreach ( self::$users as $user ) {
14 $this->runTokenTest( $user );
15 }
16 }
17
18 protected function runTokenTest( TestUser $user ) {
19 $tokens = $this->getTokenList( $user );
20
21 $rights = $user->getUser()->getRights();
22
23 $this->assertArrayHasKey( 'edittoken', $tokens );
24 $this->assertArrayHasKey( 'movetoken', $tokens );
25
26 if ( isset( $rights['delete'] ) ) {
27 $this->assertArrayHasKey( 'deletetoken', $tokens );
28 }
29
30 if ( isset( $rights['block'] ) ) {
31 $this->assertArrayHasKey( 'blocktoken', $tokens );
32 $this->assertArrayHasKey( 'unblocktoken', $tokens );
33 }
34
35 if ( isset( $rights['protect'] ) ) {
36 $this->assertArrayHasKey( 'protecttoken', $tokens );
37 }
38 }
39
40}
getTokenList(TestUser $user, $session=null)
API Database medium.
runTokenTest(TestUser $user)
Wraps the user object, so we can also retain full access to properties like password if we log in via...
Definition TestUser.php:7
$tokens