23 'action' =>
'checktoken',
25 'token' =>
$tokens[0][
'query'][
'tokens'][
'csrftoken'],
26 ],
$tokens[1]->getSessionArray() );
28 $this->assertEquals(
'valid', $data[0][
'checktoken'][
'result'] );
29 $this->assertArrayHasKey(
'generated', $data[0][
'checktoken'] );
38 'action' =>
'checktoken',
40 'token' =>
'invalid_token',
43 $this->assertEquals(
'invalid', $data[0][
'checktoken'][
'result'] );
57 'action' =>
'checktoken',
59 'token' =>
$tokens[0][
'query'][
'tokens'][
'csrftoken'],
61 ],
$tokens[1]->getSessionArray() );
63 $this->assertEquals(
'expired', $data[0][
'checktoken'][
'result'] );
64 $this->assertArrayHasKey(
'generated', $data[0][
'checktoken'] );
78 $token =
$tokens[0][
'query'][
'tokens'][
'csrftoken'];
79 $token = substr( $token, 0, -strlen( Token::SUFFIX ) ) . urldecode( Token::SUFFIX );
82 'action' =>
'checktoken',
85 'errorformat' =>
'raw',
86 ],
$tokens[1]->getSessionArray() );
88 $this->assertEquals(
'invalid', $data[0][
'checktoken'][
'result'] );
89 $this->assertArrayHasKey(
'warnings', $data[0] );
90 $this->assertCount( 1, $data[0][
'warnings'] );
91 $this->assertEquals(
'checktoken', $data[0][
'warnings'][0][
'module'] );
92 $this->assertEquals(
'checktoken-percentencoding', $data[0][
'warnings'][0][
'code'] );
API medium ApiCheckToken.
testCheckTokenSuffixWarning()
Test if using token with incorrect suffix will produce a warning.
testCheckTokenInvalid()
Test result of checking invalid token.
testCheckTokenExpired()
Test result of checking token with negative max age (should be expired)
testCheckTokenValid()
Test result of checking previously queried token (should be valid)
doApiRequest(array $params, array $session=null, $appendModule=false, User $user=null, $tokenType=null)
Does the API request and returns the result.