Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy379 committed Dec 17, 2024
1 parent 7bfe2ad commit c6b2de1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions tests/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ class Config
*/
public const HTTP_HOST = 'example.com';

/**
* The $_SERVER['REQUEST_SCHEME'] variable is not set form CLI, so we add it
*/
public const REQUEST_SCHEME = 'https';

/**
* An ID for the third party client
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Factories/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ private function build(?string $identifier = null): ClientEntityInterface
$client = new ClientEntity();
$client->setIdentifier($identifier ?? Config::CLIENT_ID);
$client->setName('a_third_party_client');
$client->setRedirectUri('https://' . Config::HTTP_HOST . '/');
$client->setRedirectUri(Config::REQUEST_SCHEME . '://' . Config::HTTP_HOST . '/');
$client->setConfidential();

return $client;
Expand Down
1 change: 1 addition & 0 deletions tests/Feature/IdTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class IdTokenTest extends TestCase
protected function setUp(): void
{
$_SERVER['HTTP_HOST'] = Config::HTTP_HOST;
$_SERVER['REQUEST_SCHEME'] = Config::REQUEST_SCHEME;
}

public function test_can_create_id_token_responses()
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/TokensTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function test_id_token_is_valid()
$isValid = $config->validator()->validate(
$token,
...[
new IssuedBy('https://' . Config::HTTP_HOST),
new IssuedBy(Config::REQUEST_SCHEME . '://' . Config::HTTP_HOST),
new PermittedFor(Config::CLIENT_ID),
new RelatedTo(Config::USER_ID),
new SignedWith(
Expand Down

0 comments on commit c6b2de1

Please sign in to comment.