Skip to content

Commit

Permalink
Merge pull request #79 from trikoder/symfony-4.3
Browse files Browse the repository at this point in the history
Test against Symfony 4.3 in CI
  • Loading branch information
X-Coder264 authored Jul 3, 2019
2 parents 9f4911c + 58b4a40 commit e4cf668
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ env:
# PHP 7.2
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=3.4.0
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=4.2.0
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=4.3.0
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=3.4.0
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=4.2.0
- PHP_VERSION=7.2 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=4.3.0

# PHP 7.3
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=3.4.0
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=4.2.0
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=nyholm SYMFONY_VERSION=4.3.0
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=3.4.0
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=4.2.0
- PHP_VERSION=7.3 PSR_HTTP_PROVIDER=zendframework SYMFONY_VERSION=4.3.0

install:
- dev/bin/docker-compose build --build-arg PHP_VERSION=${PHP_VERSION} php
Expand Down
4 changes: 2 additions & 2 deletions Tests/Acceptance/DeleteClientCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testDeleteClient(): void
$output = $commandTester->getDisplay();
$this->assertStringContainsString('Given oAuth2 client deleted successfully', $output);

$client = $this->getClient($client->getIdentifier());
$client = $this->findClient($client->getIdentifier());
$this->assertNull($client);
}

Expand All @@ -42,7 +42,7 @@ public function testDeleteNonExistentClient(): void
$this->assertStringContainsString(sprintf('oAuth2 client identified as "%s" does not exist', $identifierName), $output);
}

private function getClient($identifier): ?Client
private function findClient($identifier): ?Client
{
return
$this
Expand Down
83 changes: 52 additions & 31 deletions Tests/Integration/AuthorizationServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,14 @@ public function testSuccessfulImplicitRequest(): void
'client_id' => 'foo',
]);

$response = $this->handleAuthorizationRequest($request);
timecop_freeze(new DateTime());

try {
$response = $this->handleAuthorizationRequest($request);
} finally {
timecop_return();
}

$this->assertSame(302, $response->getStatusCode());
$responseData = [];
parse_str(parse_url($response->getHeaderLine('Location'), PHP_URL_FRAGMENT), $responseData);
Expand All @@ -767,12 +774,19 @@ public function testSuccessfulImplicitRequest(): void
public function testSuccessfulImplicitRequestWithState(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'foo',
'state' => 'quzbaz',
]);
'response_type' => 'token',
'client_id' => 'foo',
'state' => 'quzbaz',
]);

timecop_freeze(new DateTime());

try {
$response = $this->handleAuthorizationRequest($request);
} finally {
timecop_return();
}

$response = $this->handleAuthorizationRequest($request);
$this->assertSame(302, $response->getStatusCode());
$responseData = [];
parse_str(parse_url($response->getHeaderLine('Location'), PHP_URL_FRAGMENT), $responseData);
Expand All @@ -789,12 +803,19 @@ public function testSuccessfulImplicitRequestWithState(): void
public function testSuccessfulImplicitRequestRedirectUri(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'foo',
'redirect_uri' => 'https://example.org/oauth2/redirect-uri',
]);
'response_type' => 'token',
'client_id' => 'foo',
'redirect_uri' => 'https://example.org/oauth2/redirect-uri',
]);

timecop_freeze(new DateTime());

try {
$response = $this->handleAuthorizationRequest($request);
} finally {
timecop_return();
}

$response = $this->handleAuthorizationRequest($request);
$this->assertSame(302, $response->getStatusCode());
$responseData = [];
parse_str(parse_url($response->getHeaderLine('Location'), PHP_URL_FRAGMENT), $responseData);
Expand All @@ -810,10 +831,10 @@ public function testSuccessfulImplicitRequestRedirectUri(): void
public function testImplicitRequestWithInvalidScope(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'foo',
'scope' => 'non_existing',
]);
'response_type' => 'token',
'client_id' => 'foo',
'scope' => 'non_existing',
]);

$response = $this->handleAuthorizationRequest($request);
$this->assertSame(302, $response->getStatusCode());
Expand All @@ -829,10 +850,10 @@ public function testImplicitRequestWithInvalidScope(): void
public function testImplicitRequestWithInvalidRedirectUri(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'foo',
'redirect_uri' => 'https://example.org/oauth2/other-uri',
]);
'response_type' => 'token',
'client_id' => 'foo',
'redirect_uri' => 'https://example.org/oauth2/other-uri',
]);

$response = $this->handleAuthorizationRequest($request);
$this->assertSame(401, $response->getStatusCode());
Expand All @@ -846,9 +867,9 @@ public function testImplicitRequestWithInvalidRedirectUri(): void
public function testDeniedImplicitRequest(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'foo',
]);
'response_type' => 'token',
'client_id' => 'foo',
]);

$response = $this->handleAuthorizationRequest($request, false);
$this->assertSame(302, $response->getStatusCode());
Expand All @@ -864,9 +885,9 @@ public function testDeniedImplicitRequest(): void
public function testImplicitRequestWithMissingClient(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'yolo',
]);
'response_type' => 'token',
'client_id' => 'yolo',
]);

$response = $this->handleAuthorizationRequest($request, false);
$this->assertSame(401, $response->getStatusCode());
Expand All @@ -880,9 +901,9 @@ public function testImplicitRequestWithMissingClient(): void
public function testImplicitRequestWithInactiveClient(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'baz_inactive',
]);
'response_type' => 'token',
'client_id' => 'baz_inactive',
]);

$response = $this->handleAuthorizationRequest($request, false);
$this->assertSame(401, $response->getStatusCode());
Expand All @@ -896,9 +917,9 @@ public function testImplicitRequestWithInactiveClient(): void
public function testImplicitRequestWithRestrictedGrantClient(): void
{
$request = $this->createAuthorizeRequest(null, [
'response_type' => 'token',
'client_id' => 'qux_restricted',
]);
'response_type' => 'token',
'client_id' => 'qux_restricted',
]);

$response = $this->handleAuthorizationRequest($request, false);
$this->assertSame(401, $response->getStatusCode());
Expand Down

0 comments on commit e4cf668

Please sign in to comment.