-
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.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
.../AppTest/Service/Authentication/Token/OutOfBandCoreIdentityVerifierBuilderFactoryTest.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,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace AppTest\Service\Authentication\Token; | ||
|
||
use App\Service\Authentication\Token\OutOfBandCoreIdentityVerifierBuilder; | ||
use App\Service\Authentication\Token\OutOfBandCoreIdentityVerifierBuilderFactory; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\PhpUnit\ProphecyTrait; | ||
use Psr\Clock\ClockInterface; | ||
use Psr\Container\ContainerInterface; | ||
use RuntimeException; | ||
|
||
/** | ||
* @coversDefaultClass \App\Service\Authentication\Token\OutOfBandCoreIdentityVerifierBuilderFactory | ||
*/ | ||
class OutOfBandCoreIdentityVerifierBuilderFactoryTest extends TestCase | ||
{ | ||
use ProphecyTrait; | ||
|
||
/** | ||
* @test | ||
* @covers ::__invoke() | ||
*/ | ||
public function it_builds_a_verifier_builder(): void | ||
{ | ||
$container = $this->prophesize(ContainerInterface::class); | ||
$container->get('config')->willReturn( | ||
[ | ||
'one_login' => [ | ||
'identity_issuer' => 'https://fakeUrl' | ||
] | ||
] | ||
); | ||
$container->get(ClockInterface::class)->willReturn($this->prophesize(ClockInterface::class)->reveal()); | ||
|
||
$sut = new OutOfBandCoreIdentityVerifierBuilderFactory(); | ||
|
||
$result = $sut($container->reveal()); | ||
|
||
$this->assertInstanceOf(OutOfBandCoreIdentityVerifierBuilder::class, $result); | ||
} | ||
|
||
/** | ||
* @test | ||
* @covers ::__invoke() | ||
*/ | ||
public function it_throws_an_exception_when_config_missing(): void | ||
{ | ||
$container = $this->prophesize(ContainerInterface::class); | ||
$container->get('config')->willReturn([]); | ||
|
||
$sut = new OutOfBandCoreIdentityVerifierBuilderFactory(); | ||
|
||
$this->expectException(RuntimeException::class); | ||
$result = $sut($container->reveal()); | ||
} | ||
} |