| @@ 17-54 (lines=38) @@ | ||
| 14 | use Symfony\Component\DependencyInjection\Definition; |
|
| 15 | use Symfony\Component\DependencyInjection\Reference; |
|
| 16 | ||
| 17 | class IdentityDefinerPassTest extends AbstractCompilerPassTestCase |
|
| 18 | { |
|
| 19 | protected function setUp() |
|
| 20 | { |
|
| 21 | parent::setUp(); |
|
| 22 | $this->setDefinition('ezpublish.user.hash_generator', new Definition()); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Register the compiler pass under test, just like you would do inside a bundle's load() |
|
| 27 | * method:. |
|
| 28 | * |
|
| 29 | * $container->addCompilerPass(new MyCompilerPass()); |
|
| 30 | */ |
|
| 31 | protected function registerCompilerPass(ContainerBuilder $container) |
|
| 32 | { |
|
| 33 | $container->addCompilerPass(new IdentityDefinerPass()); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @covers \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler\IdentityDefinerPass::process |
|
| 38 | */ |
|
| 39 | public function testSetIdentityDefiner() |
|
| 40 | { |
|
| 41 | $def = new Definition(); |
|
| 42 | $def->addTag('ezpublish.identity_definer'); |
|
| 43 | $serviceId = 'some_service_id'; |
|
| 44 | $this->setDefinition($serviceId, $def); |
|
| 45 | ||
| 46 | $this->compile(); |
|
| 47 | ||
| 48 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 49 | 'ezpublish.user.hash_generator', |
|
| 50 | 'setIdentityDefiner', |
|
| 51 | array(new Reference($serviceId)) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||
| @@ 17-54 (lines=38) @@ | ||
| 14 | use Symfony\Component\DependencyInjection\Definition; |
|
| 15 | use Symfony\Component\DependencyInjection\Reference; |
|
| 16 | ||
| 17 | class RoleLimitationConverterPassTest extends AbstractCompilerPassTestCase |
|
| 18 | { |
|
| 19 | protected function setUp() |
|
| 20 | { |
|
| 21 | parent::setUp(); |
|
| 22 | $this->setDefinition( |
|
| 23 | 'ezpublish.persistence.legacy.role.limitation.converter', |
|
| 24 | new Definition() |
|
| 25 | ); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * Register the compiler pass under test, just like you would do inside a bundle's load() |
|
| 30 | * method:. |
|
| 31 | * |
|
| 32 | * $container->addCompilerPass(new MyCompilerPass()); |
|
| 33 | */ |
|
| 34 | protected function registerCompilerPass(ContainerBuilder $container) |
|
| 35 | { |
|
| 36 | $container->addCompilerPass(new RoleLimitationConverterPass()); |
|
| 37 | } |
|
| 38 | ||
| 39 | public function testRegisterRoleLimitationConverter() |
|
| 40 | { |
|
| 41 | $serviceId = 'service_id'; |
|
| 42 | $def = new Definition(); |
|
| 43 | $def->addTag('ezpublish.persistence.legacy.role.limitation.handler'); |
|
| 44 | $this->setDefinition($serviceId, $def); |
|
| 45 | ||
| 46 | $this->compile(); |
|
| 47 | ||
| 48 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 49 | 'ezpublish.persistence.legacy.role.limitation.converter', |
|
| 50 | 'addHandler', |
|
| 51 | array(new Reference($serviceId)) |
|
| 52 | ); |
|
| 53 | } |
|
| 54 | } |
|
| 55 | ||