-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implemented caching * fix linting error * Add unit test coverage for IssuerBuilder setMetaDataProviderBuilder() * fix linting and ignore code coverage for build method --------- Co-authored-by: Mishkat Najam <[email protected]>
- Loading branch information
Showing
4 changed files
with
88 additions
and
10 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
service-api/app/src/App/src/Service/Authentication/IssuerBuilder.php
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Service\Authentication; | ||
|
||
use Facile\OpenIDClient\Issuer\IssuerBuilderInterface; | ||
use Facile\OpenIDClient\Issuer\IssuerInterface; | ||
use Facile\OpenIDClient\Issuer\Metadata\Provider\MetadataProviderBuilder; | ||
use Facile\OpenIDClient\Issuer\IssuerBuilder as FacileIssuerBuilder; | ||
|
||
class IssuerBuilder implements IssuerBuilderInterface | ||
{ | ||
private FacileIssuerBuilder $issuerBuilder; | ||
|
||
public function __construct() | ||
{ | ||
$this->issuerBuilder = new FacileIssuerBuilder(); | ||
} | ||
|
||
public function setMetadataProviderBuilder(?MetadataProviderBuilder $metadataProviderBuilder): self | ||
{ | ||
$this->issuerBuilder->setMetadataProviderBuilder($metadataProviderBuilder); | ||
return $this; | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
*/ | ||
public function build(string $resource): IssuerInterface | ||
{ | ||
return $this->issuerBuilder->build($resource); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
service-api/app/test/AppTest/Service/Authentication/IssuerBuilderTest.php
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppTest\Service\Authentication; | ||
|
||
use App\Service\Authentication\IssuerBuilder; | ||
use Facile\OpenIDClient\Issuer\Metadata\Provider\MetadataProviderBuilder; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class IssuerBuilderTest extends TestCase | ||
{ | ||
private IssuerBuilder $issuerBuilder; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->issuerBuilder = new IssuerBuilder(); | ||
} | ||
|
||
/** @test */ | ||
public function can_set_metadata_provider_builder(): void | ||
{ | ||
$issuerBuilder = $this->issuerBuilder->setMetadataProviderBuilder(new MetadataProviderBuilder()); | ||
self::assertInstanceOf(IssuerBuilder::class, $issuerBuilder); | ||
} | ||
} |
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