diff options
Diffstat (limited to 'OAuth/tests/phpunit/Rest/AuthorizationEndpointTest.php')
-rw-r--r-- | OAuth/tests/phpunit/Rest/AuthorizationEndpointTest.php | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/OAuth/tests/phpunit/Rest/AuthorizationEndpointTest.php b/OAuth/tests/phpunit/Rest/AuthorizationEndpointTest.php new file mode 100644 index 00000000..599c17c6 --- /dev/null +++ b/OAuth/tests/phpunit/Rest/AuthorizationEndpointTest.php @@ -0,0 +1,43 @@ +<?php + +namespace MediaWiki\Extensions\OAuth\Tests\Rest; + +/** + * @covers \MediaWiki\Extensions\OAuth\Rest\Handler\Authorize + */ +class AuthorizationEndpointTest extends EndpointTest { + /** + * @return array + */ + public static function provideTestViaRouter() { + return [ + 'redirect to login' => [ + [ + 'method' => 'GET', + 'uri' => self::makeUri( '/oauth2/authorize' ), + 'queryParams' => [ + 'client_id' => 'dummy', + 'response_type' => 'code' + ] + ], + [ + 'statusCode' => 307, + 'reasonPhrase' => 'Temporary Redirect', + 'protocolVersion' => '1.1' + ] + ], + 'method not allowed' => [ + [ + 'method' => 'POST', + 'uri' => self::makeUri( '/oauth2/authorize' ), + ], + [ + 'statusCode' => 405, + 'reasonPhrase' => 'Method Not Allowed', + 'protocolVersion' => '1.1', + 'body' => '{"httpCode":405,"httpReason":"Method Not Allowed"}', + ] + ], + ]; + } +} |