Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply some code formatting #11

Merged
merged 1 commit into from
Aug 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Http/Controllers/RetrievesAuthRequestFromSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function getAuthRequestFromSession(Request $request)
{
return tap($request->session()->get('authRequest'), function ($authRequest) use ($request) {
if (! $authRequest) {
throw new Exception("Authorization request was not present in the session.");
throw new Exception('Authorization request was not present in the session.');
}

$authRequest->setUser(new User($request->user()->id));
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Middleware/CreateFreshApiToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function requestShouldReceiveFreshToken($request)
protected function responseShouldReceiveFreshToken($response)
{
return $response instanceof Response &&
! $this->alreadyContainsToken($response);
! $this->alreadyContainsToken($response);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Passport.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function scopesFor(array $ids)
return new Scope($id, static::$scopes[$id]);
}

return null;
return;
})->filter()->values()->all();
}

Expand Down
2 changes: 1 addition & 1 deletion src/PersonalAccessTokenFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function make($userId, $name, array $scopes = [])
$token = tap($this->findAccessToken($response), function ($token) use ($userId, $name) {
$this->tokens->save($token->forceFill([
'user_id' => $userId,
'name' => $name
'name' => $name,
]));
});

Expand Down
2 changes: 1 addition & 1 deletion src/PersonalAccessTokenResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function toArray()
{
return [
'accessToken' => $this->accessToken,
'token' => $this->token
'token' => $this->token,
];
}

Expand Down
9 changes: 4 additions & 5 deletions src/RouteRegistrar.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,17 @@ public function forAuthorization()
{
$this->router->group(['middleware' => ['web', 'auth']], function ($router) {
$router->get('/oauth/authorize', [
'uses' => 'AuthorizationController@authorize'
'uses' => 'AuthorizationController@authorize',
]);

$router->post('/oauth/authorize', [
'uses' => 'ApproveAuthorizationController@approve'
'uses' => 'ApproveAuthorizationController@approve',
]);

$router->delete('/oauth/authorize', [
'uses' => 'DenyAuthorizationController@deny'
'uses' => 'DenyAuthorizationController@deny',
]);
});

}

/**
Expand All @@ -69,7 +68,7 @@ public function forAuthorization()
public function forAccessTokens()
{
$this->router->post('/oauth/token', [
'uses' => 'AccessTokenController@issueToken'
'uses' => 'AccessTokenController@issueToken',
]);

$this->router->group(['middleware' => ['web', 'auth']], function ($router) {
Expand Down
1 change: 0 additions & 1 deletion tests/AuthorizationControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public function test_authorization_view_is_presented()
$authRequest->shouldReceive('getClient->getIdentifier')->andReturn(1);
$authRequest->shouldReceive('getScopes')->andReturn([new Laravel\Passport\Bridge\Scope('scope-1')]);


$response->shouldReceive('view')->once()->andReturnUsing(function ($view, $data) use ($authRequest) {
$this->assertEquals('passport::authorize', $view);
$this->assertEquals('client', $data['client']);
Expand Down
5 changes: 4 additions & 1 deletion tests/AuthorizedAccessTokenControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public function test_tokens_can_be_retrieved_for_users()
$token1->client = (object) ['personal_access_client' => true];
$token2->client = (object) ['personal_access_client' => false];
$user->tokens->shouldReceive('load')->with('client')->andReturn(collect([
$token1, $token2
$token1, $token2,
]));

return $user;
});

Expand All @@ -50,6 +51,7 @@ public function test_tokens_can_be_deleted()
$user = Mockery::mock();
$user->id = 1;
$user->tokens = new Illuminate\Database\Eloquent\Collection([$token1, $token2]);

return $user;
});

Expand All @@ -74,6 +76,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token()
$user = Mockery::mock();
$user->id = 1;
$user->tokens = new Illuminate\Database\Eloquent\Collection([$token1, $token2]);

return $user;
});

Expand Down
4 changes: 4 additions & 0 deletions tests/ClientControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function test_clients_can_be_updated()
$user->clients->shouldReceive('find')->with(1)->andReturn(
$client = Mockery::mock('Laravel\Passport\Client')
);

return $user;
});

Expand Down Expand Up @@ -101,6 +102,7 @@ public function test_404_response_if_client_doesnt_belong_to_user()
$user->id = 1;
$user->clients = Mockery::mock();
$user->clients->shouldReceive('find')->with(1)->andReturn(null);

return $user;
});

Expand Down Expand Up @@ -128,6 +130,7 @@ public function test_clients_can_be_deleted()
$user->clients->shouldReceive('find')->with(1)->andReturn(
$client = Mockery::mock('Laravel\Passport\Client')
);

return $user;
});

Expand Down Expand Up @@ -155,6 +158,7 @@ public function test_404_response_if_client_doesnt_belong_to_user_on_delete()
$user->id = 1;
$user->clients = Mockery::mock();
$user->clients->shouldReceive('find')->with(1)->andReturn(null);

return $user;
});

Expand Down
6 changes: 5 additions & 1 deletion tests/PersonalAccessTokenControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ public function test_tokens_can_be_retrieved_for_users()
$token1->client = (object) ['personal_access_client' => true];
$token2->client = (object) ['personal_access_client' => false];
$user->tokens->shouldReceive('load')->with('client')->andReturn(collect([
$token1, $token2
$token1, $token2,
]));

return $user;
});

Expand All @@ -48,6 +49,7 @@ public function test_tokens_can_be_updated()
$request->setUserResolver(function () {
$user = Mockery::mock();
$user->shouldReceive('createToken')->once()->with('token name', ['user', 'user-admin'])->andReturn('response');

return $user;
});

Expand Down Expand Up @@ -83,6 +85,7 @@ public function test_tokens_can_be_deleted()
$user = Mockery::mock();
$user->id = 1;
$user->tokens = new Illuminate\Database\Eloquent\Collection([$token1, $token2]);

return $user;
});

Expand All @@ -107,6 +110,7 @@ public function test_not_found_response_is_returned_if_user_doesnt_have_token()
$user = Mockery::mock();
$user->id = 1;
$user->tokens = new Illuminate\Database\Eloquent\Collection([$token1, $token2]);

return $user;
});

Expand Down