@@ -17,7 +17,7 @@ |
||
| 17 | 17 | $entity = new AccessTokenEntity($this->server); |
| 18 | 18 | |
| 19 | 19 | $entity->setId('mF_9.B5f-4.1JqM'); |
| 20 | - $entity->setExpireTime(time() + 24*60*60); // NOW + 24h |
|
| 20 | + $entity->setExpireTime(time() + 24 * 60 * 60); // NOW + 24h |
|
| 21 | 21 | |
| 22 | 22 | return $entity; |
| 23 | 23 | } |
@@ -9,6 +9,6 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | public function __construct($basePath = null) |
| 11 | 11 | { |
| 12 | - parent::__construct(realpath(__DIR__ . '/../')); |
|
| 12 | + parent::__construct(realpath(__DIR__.'/../')); |
|
| 13 | 13 | } |
| 14 | 14 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | 'grant_types' => [ |
| 45 | 45 | 'password' => [ |
| 46 | 46 | 'class' => League\OAuth2\Server\Grant\PasswordGrant::class, |
| 47 | - 'callback' => function ($username, $password) { |
|
| 47 | + 'callback' => function($username, $password) { |
|
| 48 | 48 | return $username.'/'.$password; |
| 49 | 49 | }, |
| 50 | 50 | 'access_token_ttl' => 3600, |
@@ -3,4 +3,4 @@ |
||
| 3 | 3 | |
| 4 | 4 | date_default_timezone_set('UTC'); |
| 5 | 5 | |
| 6 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 6 | +require __DIR__.'/../vendor/autoload.php'; |
|
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/../_support/Mock/MockStorageServiceProvider.php'; |
|
| 3 | +require_once __DIR__.'/../_support/Mock/MockStorageServiceProvider.php'; |
|
| 4 | 4 | |
| 5 | 5 | use Nord\Lumen\OAuth2\OAuth2Facade; |
| 6 | 6 | use Nord\Lumen\OAuth2\OAuth2Service; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function testAssertCanBeRegistered() |
| 38 | 38 | { |
| 39 | - $this->specify('verify serviceProvider is registered', function () { |
|
| 39 | + $this->specify('verify serviceProvider is registered', function() { |
|
| 40 | 40 | $service = $this->app->make(OAuth2Service::class); |
| 41 | 41 | verify($service)->isInstanceOf(OAuth2Service::class); |
| 42 | 42 | }); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | */ |
| 48 | 48 | public function testAssertFacade() |
| 49 | 49 | { |
| 50 | - $this->specify('verify serviceProvider facade', function () { |
|
| 50 | + $this->specify('verify serviceProvider facade', function() { |
|
| 51 | 51 | verify(OAuth2Facade::getFacadeRoot())->isInstanceOf(OAuth2Service::class); |
| 52 | 52 | }); |
| 53 | 53 | } |
@@ -1,4 +1,4 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | // Here you can initialize variables that will be available to your tests |
| 3 | 3 | |
| 4 | -require_once __DIR__ . '/../_support/Mock/MockApplication.php'; |
|
| 4 | +require_once __DIR__.'/../_support/Mock/MockApplication.php'; |
|
@@ -34,15 +34,15 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function testAssertIssueAccessToken() |
| 36 | 36 | { |
| 37 | - $this->specify('verify service issueAccessToken', function () { |
|
| 38 | - $authorizationServer = $this->createAuthorizationServer(); |
|
| 39 | - $authorizationServer->expects($this->once()) |
|
| 40 | - ->method('issueAccessToken') |
|
| 41 | - ->will($this->returnValue(self::$token)); |
|
| 37 | + $this->specify('verify service issueAccessToken', function () { |
|
| 38 | + $authorizationServer = $this->createAuthorizationServer(); |
|
| 39 | + $authorizationServer->expects($this->once()) |
|
| 40 | + ->method('issueAccessToken') |
|
| 41 | + ->will($this->returnValue(self::$token)); |
|
| 42 | 42 | |
| 43 | - $service = new OAuth2Service($authorizationServer, $this->createResourceServer()); |
|
| 44 | - verify($service->issueAccessToken())->equals(self::$token); |
|
| 45 | - }); |
|
| 43 | + $service = new OAuth2Service($authorizationServer, $this->createResourceServer()); |
|
| 44 | + verify($service->issueAccessToken())->equals(self::$token); |
|
| 45 | + }); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function testAssertIssueAccessToken() |
| 36 | 36 | { |
| 37 | - $this->specify('verify service issueAccessToken', function () { |
|
| 37 | + $this->specify('verify service issueAccessToken', function() { |
|
| 38 | 38 | $authorizationServer = $this->createAuthorizationServer(); |
| 39 | 39 | $authorizationServer->expects($this->once()) |
| 40 | 40 | ->method('issueAccessToken') |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function testAssertValidateAccessToken() |
| 52 | 52 | { |
| 53 | - $this->specify('verify service validateAccessToken', function () { |
|
| 53 | + $this->specify('verify service validateAccessToken', function() { |
|
| 54 | 54 | $service = new OAuth2Service($this->createAuthorizationServer(), $this->createResourceServer()); |
| 55 | 55 | verify($service->validateAccessToken(true, self::$token['access_token']))->true(); |
| 56 | 56 | }); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function testAssertGetResourceOwnerId() |
| 63 | 63 | { |
| 64 | - $this->specify('verify service can getResourceOwnerId', function () { |
|
| 64 | + $this->specify('verify service can getResourceOwnerId', function() { |
|
| 65 | 65 | $service = new OAuth2Service($this->createAuthorizationServer(), $this->createResourceServer()); |
| 66 | 66 | $service->validateAccessToken(true, self::$token['access_token']); |
| 67 | 67 | verify($service->getResourceOwnerId())->equals('test'); |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function testAssertGetResourceOwnerType() |
| 75 | 75 | { |
| 76 | - $this->specify('verify service can getResourceOwnerType', function () { |
|
| 76 | + $this->specify('verify service can getResourceOwnerType', function() { |
|
| 77 | 77 | $service = new OAuth2Service($this->createAuthorizationServer(), $this->createResourceServer()); |
| 78 | 78 | $service->validateAccessToken(true, self::$token['access_token']); |
| 79 | 79 | verify($service->getResourceOwnerType())->equals('test'); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function testAssertGetClientId() |
| 87 | 87 | { |
| 88 | - $this->specify('verify service can getClientId', function () { |
|
| 88 | + $this->specify('verify service can getClientId', function() { |
|
| 89 | 89 | $service = new OAuth2Service($this->createAuthorizationServer(), $this->createResourceServer()); |
| 90 | 90 | $service->validateAccessToken(true, self::$token['access_token']); |
| 91 | 91 | verify($service->getClientId())->equals('test'); |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | */ |
| 35 | 35 | public function testAssertValidAccessToken() |
| 36 | 36 | { |
| 37 | - $this->specify('verify middleware valid access token', function () { |
|
| 38 | - $_SERVER['HTTP_AUTHORIZATION'] = 'Bearer mF_9.B5f-4.1JqM'; |
|
| 39 | - $middleware = new OAuth2Middleware(); |
|
| 40 | - verify($middleware->handle($this->createRequest(), function () { return true; }))->equals(true); |
|
| 41 | - }); |
|
| 37 | + $this->specify('verify middleware valid access token', function () { |
|
| 38 | + $_SERVER['HTTP_AUTHORIZATION'] = 'Bearer mF_9.B5f-4.1JqM'; |
|
| 39 | + $middleware = new OAuth2Middleware(); |
|
| 40 | + verify($middleware->handle($this->createRequest(), function () { return true; }))->equals(true); |
|
| 41 | + }); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/../_support/Mock/MockStorageServiceProvider.php'; |
|
| 3 | +require_once __DIR__.'/../_support/Mock/MockStorageServiceProvider.php'; |
|
| 4 | 4 | |
| 5 | 5 | use Nord\Lumen\OAuth2\OAuth2ServiceProvider; |
| 6 | 6 | use Nord\Lumen\OAuth2\Middleware\OAuth2Middleware; |
@@ -34,10 +34,10 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function testAssertValidAccessToken() |
| 36 | 36 | { |
| 37 | - $this->specify('verify middleware valid access token', function () { |
|
| 37 | + $this->specify('verify middleware valid access token', function() { |
|
| 38 | 38 | $_SERVER['HTTP_AUTHORIZATION'] = 'Bearer mF_9.B5f-4.1JqM'; |
| 39 | 39 | $middleware = new OAuth2Middleware(); |
| 40 | - verify($middleware->handle($this->createRequest(), function () { return true; }))->equals(true); |
|
| 40 | + verify($middleware->handle($this->createRequest(), function() { return true; }))->equals(true); |
|
| 41 | 41 | }); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function testAssertInvalidAccessToken() |
| 48 | 48 | { |
| 49 | - $this->specify('verify middleware invalid access token', function () { |
|
| 49 | + $this->specify('verify middleware invalid access token', function() { |
|
| 50 | 50 | $middleware = new OAuth2Middleware(); |
| 51 | - $res = $middleware->handle($this->createRequest(), function () { return true; }); |
|
| 51 | + $res = $middleware->handle($this->createRequest(), function() { return true; }); |
|
| 52 | 52 | verify($res)->isInstanceOf(Illuminate\Http\JsonResponse::class); |
| 53 | - verify((array)$res->getData())->equals(['message' => 'ERROR.ACCESS_DENIED']); |
|
| 53 | + verify((array) $res->getData())->equals(['message' => 'ERROR.ACCESS_DENIED']); |
|
| 54 | 54 | }); |
| 55 | 55 | } |
| 56 | 56 | |