1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<?php
namespace MediaWiki\Extensions\OAuth\Tests\Rest;
/**
* @covers \MediaWiki\Extensions\OAuth\Rest\Handler\AccessToken
*/
class AccessTokenEndpointTest extends EndpointTest {
public static function provideTestViaRouter() {
return [
'normal' => [
[
'method' => 'POST',
'uri' => self::makeUri( '/oauth2/access_token' ),
'headers' => [
'Content-Type' => 'application/json'
],
'postParams' => [
'grant_type' => 'authorization_code',
'client_id' => 'dummy'
]
],
[
'statusCode' => 401,
'reasonPhrase' => 'Unauthorized',
'protocolVersion' => '1.1'
]
],
'method not allowed' => [
[
'method' => 'GET',
'uri' => self::makeUri( '/oauth2/access_token' ),
],
[
'statusCode' => 405,
'reasonPhrase' => 'Method Not Allowed',
'protocolVersion' => '1.1',
'body' => '{"httpCode":405,"httpReason":"Method Not Allowed"}',
]
],
'invalid grant type' => [
[
'method' => 'POST',
'uri' => self::makeUri( '/oauth2/access_token' ),
'postParams' => [
'grant_type' => 'dummy',
'client_id' => 'dummy'
]
],
[
'statusCode' => 400,
'reasonPhrase' => 'Bad Request',
'protocolVersion' => '1.1'
]
],
'grant type missing' => [
[
'method' => 'POST',
'uri' => self::makeUri( '/oauth2/access_token' ),
'postParams' => [
'client_id' => 'dummy'
]
],
[
'statusCode' => 400,
'reasonPhrase' => 'Bad Request',
'protocolVersion' => '1.1'
]
],
];
}
}
|