| @@ 18-50 (lines=33) @@ | ||
| 15 | use Symfony\Component\DependencyInjection\Definition; |
|
| 16 | use Symfony\Component\DependencyInjection\Reference; |
|
| 17 | ||
| 18 | class SiteAccessMatcherRegistryPassTest extends AbstractCompilerPassTestCase |
|
| 19 | { |
|
| 20 | protected function setUp(): void |
|
| 21 | { |
|
| 22 | parent::setUp(); |
|
| 23 | ||
| 24 | $this->setDefinition(SiteAccessMatcherRegistry::class, new Definition()); |
|
| 25 | } |
|
| 26 | ||
| 27 | protected function registerCompilerPass(ContainerBuilder $container): void |
|
| 28 | { |
|
| 29 | $container->addCompilerPass(new SiteAccessMatcherRegistryPass()); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testSetMatcher(): void |
|
| 33 | { |
|
| 34 | $def = new Definition(); |
|
| 35 | $def->addTag(SiteAccessMatcherRegistryPass::MATCHER_TAG); |
|
| 36 | $serviceId = 'service_id'; |
|
| 37 | $this->setDefinition($serviceId, $def); |
|
| 38 | ||
| 39 | $this->compile(); |
|
| 40 | ||
| 41 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 42 | SiteAccessMatcherRegistry::class, |
|
| 43 | 'setMatcher', |
|
| 44 | [ |
|
| 45 | $serviceId, |
|
| 46 | new Reference($serviceId), |
|
| 47 | ] |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||
| @@ 18-50 (lines=33) @@ | ||
| 15 | use Symfony\Component\DependencyInjection\Definition; |
|
| 16 | use Symfony\Component\DependencyInjection\Reference; |
|
| 17 | ||
| 18 | class ViewMatcherRegistryPassTest extends AbstractCompilerPassTestCase |
|
| 19 | { |
|
| 20 | protected function setUp(): void |
|
| 21 | { |
|
| 22 | parent::setUp(); |
|
| 23 | ||
| 24 | $this->setDefinition(ViewMatcherRegistry::class, new Definition()); |
|
| 25 | } |
|
| 26 | ||
| 27 | protected function registerCompilerPass(ContainerBuilder $container): void |
|
| 28 | { |
|
| 29 | $container->addCompilerPass(new ViewMatcherRegistryPass()); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testSetMatcher(): void |
|
| 33 | { |
|
| 34 | $def = new Definition(); |
|
| 35 | $def->addTag(ViewMatcherRegistryPass::MATCHER_TAG); |
|
| 36 | $serviceId = 'service_id'; |
|
| 37 | $this->setDefinition($serviceId, $def); |
|
| 38 | ||
| 39 | $this->compile(); |
|
| 40 | ||
| 41 | $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( |
|
| 42 | ViewMatcherRegistry::class, |
|
| 43 | 'setMatcher', |
|
| 44 | [ |
|
| 45 | $serviceId, |
|
| 46 | new Reference($serviceId), |
|
| 47 | ] |
|
| 48 | ); |
|
| 49 | } |
|
| 50 | } |
|
| 51 | ||