-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c07f95
commit 1c181ee
Showing
3 changed files
with
58 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<coverage> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">./src/Configs</directory> | ||
<directory suffix=".php">./src/Routes</directory> | ||
<file>./src/ShipSaasLaravelJwksServiceProvider.php</file> | ||
</exclude> | ||
</coverage> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> | ||
<coverage/> | ||
<testsuites> | ||
<testsuite name="Laravel JWKS Test Suite"> | ||
<directory suffix=".php">./tests/</directory> | ||
<exclude>./tests/TestCase.php</exclude> | ||
<exclude>./tests/TestCase.php</exclude> | ||
</testsuite> | ||
</testsuites> | ||
<php> | ||
<ini name="memory_limit" value="-1"/> | ||
<env name="APP_KEY" value="base64:vERr555bmE1jw0bfIXthCve2bmS2CQimxGaODqTsNPo="/> | ||
</php> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
<exclude> | ||
<directory suffix=".php">./src/Configs</directory> | ||
<directory suffix=".php">./src/Routes</directory> | ||
<file>./src/ShipSaasLaravelJwksServiceProvider.php</file> | ||
</exclude> | ||
</source> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace ShipSaasLaravelJwks\Tests\Unit\Entities; | ||
|
||
use ShipSaasLaravelJwks\Entities\Key; | ||
use ShipSaasLaravelJwks\Entities\KeyConfiguration; | ||
use ShipSaasLaravelJwks\Entities\KeySet; | ||
use ShipSaasLaravelJwks\Tests\TestCase; | ||
|
||
class KeySetTest extends TestCase | ||
{ | ||
public function testKetSetCanAddAndParseToArray() | ||
{ | ||
$keyset = new KeySet(); | ||
|
||
$keyContent = file_get_contents(__DIR__ . '/../../__fixtures__/public-key.pub'); | ||
$key = Key::fromRaw($keyContent, new KeyConfiguration()); | ||
|
||
$keyset->add($key); | ||
|
||
$array = $keyset->toArray(); | ||
|
||
$this->assertNotEmpty($array); | ||
|
||
$this->assertSame($array[0]['alg'], 'RS256'); | ||
$this->assertSame($array[0]['kty'], 'RSA'); | ||
} | ||
|
||
public function testKetSetCanAddAndParseToString() | ||
{ | ||
$keyset = new KeySet(); | ||
|
||
$keyContent = file_get_contents(__DIR__ . '/../../__fixtures__/public-key.pub'); | ||
$key = Key::fromRaw($keyContent, new KeyConfiguration()); | ||
|
||
$keyset->add($key); | ||
|
||
$string = $keyset->__toString(); | ||
|
||
$this->assertNotEmpty($string); | ||
|
||
$this->assertStringContainsString('RS256', $string); | ||
$this->assertStringContainsString('RSA', $string); | ||
} | ||
} |