Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from prolic/guards
add guard factory tests
- Loading branch information
Showing
3 changed files
with
86 additions
and
1 deletion.
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
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,42 @@ | ||
<?php | ||
/* | ||
* This file is part of the prooph/service-bus. | ||
* (c) 2014-2015 prooph software GmbH <contact@prooph.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Date: 09/13/15 -7:47 PM | ||
*/ | ||
|
||
namespace Prooph\ServiceBusTest\Container\Plugin\Guard; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Prooph\ServiceBus\Container\Plugin\Guard\FinalizeGuardFactory; | ||
use Prooph\ServiceBus\Plugin\Guard\AuthorizationService; | ||
use Prooph\ServiceBus\Plugin\Guard\FinalizeGuard; | ||
|
||
/** | ||
* Class FinalizeGuardFactoryTest | ||
* @package Prooph\ServiceBusTest\Container\Plugin\Guard | ||
*/ | ||
final class FinalizeGuardFactoryTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_creates_route_guard() | ||
{ | ||
$authorizationService = $this->prophesize(AuthorizationService::class); | ||
|
||
$container = $this->prophesize(ContainerInterface::class); | ||
$container->get(AuthorizationService::class)->willReturn($authorizationService->reveal()); | ||
|
||
$factory = new FinalizeGuardFactory(); | ||
|
||
$guard = $factory($container->reveal()); | ||
|
||
$this->assertInstanceOf(FinalizeGuard::class, $guard); | ||
} | ||
} |
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,42 @@ | ||
<?php | ||
/* | ||
* This file is part of the prooph/service-bus. | ||
* (c) 2014-2015 prooph software GmbH <contact@prooph.de> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* Date: 09/13/15 -7:47 PM | ||
*/ | ||
|
||
namespace Prooph\ServiceBusTest\Container\Plugin\Guard; | ||
|
||
use Interop\Container\ContainerInterface; | ||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Prooph\ServiceBus\Container\Plugin\Guard\RouteGuardFactory; | ||
use Prooph\ServiceBus\Plugin\Guard\AuthorizationService; | ||
use Prooph\ServiceBus\Plugin\Guard\RouteGuard; | ||
|
||
/** | ||
* Class RouteGuardFactoryTest | ||
* @package Prooph\ServiceBusTest\Container\Plugin\Guard | ||
*/ | ||
final class RouteGuardFactoryTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function it_creates_route_guard() | ||
{ | ||
$authorizationService = $this->prophesize(AuthorizationService::class); | ||
|
||
$container = $this->prophesize(ContainerInterface::class); | ||
$container->get(AuthorizationService::class)->willReturn($authorizationService->reveal()); | ||
|
||
$factory = new RouteGuardFactory(); | ||
|
||
$guard = $factory($container->reveal()); | ||
|
||
$this->assertInstanceOf(RouteGuard::class, $guard); | ||
} | ||
} |