|
13 | 13 |
|
14 | 14 | use Doctrine\Common\Annotations\AnnotationReader; |
15 | 15 | use Doctrine\Common\Annotations\CachedReader; |
| 16 | +use Symfony\Component\Cache\Adapter\FilesystemAdapter; |
| 17 | +use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; |
| 18 | +use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; |
16 | 19 | use Symfony\Component\Templating\EngineInterface as ComponentEngineInterface; |
17 | 20 | use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; |
18 | 21 | use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; |
@@ -63,6 +66,30 @@ public function testEventDispatcherAutowiring() |
63 | 66 | $this->assertInstanceOf(TraceableEventDispatcher::class, $autowiredServices->getDispatcher(), 'The debug.event_dispatcher service should be injected if the debug is enabled'); |
64 | 67 | } |
65 | 68 |
|
| 69 | + public function testAccessDecisionManagerAutowiring() |
| 70 | + { |
| 71 | + static::bootKernel(array('debug' => false)); |
| 72 | + $container = static::$kernel->getContainer(); |
| 73 | + |
| 74 | + $autowiredServices = $container->get('test.autowiring_types.autowired_services'); |
| 75 | + $this->assertInstanceOf(AccessDecisionManager::class, $autowiredServices->getAccessDecisionManager(), 'The security.access.decision_manager service should be injected in debug mode'); |
| 76 | + |
| 77 | + static::bootKernel(array('debug' => true)); |
| 78 | + $container = static::$kernel->getContainer(); |
| 79 | + |
| 80 | + $autowiredServices = $container->get('test.autowiring_types.autowired_services'); |
| 81 | + $this->assertInstanceOf(TraceableAccessDecisionManager::class, $autowiredServices->getAccessDecisionManager(), 'The debug.security.access.decision_manager service should be injected in non-debug mode'); |
| 82 | + } |
| 83 | + |
| 84 | + public function testCacheAutowiring() |
| 85 | + { |
| 86 | + static::bootKernel(); |
| 87 | + $container = static::$kernel->getContainer(); |
| 88 | + |
| 89 | + $autowiredServices = $container->get('test.autowiring_types.autowired_services'); |
| 90 | + $this->assertInstanceOf(FilesystemAdapter::class, $autowiredServices->getCachePool()); |
| 91 | + } |
| 92 | + |
66 | 93 | protected static function createKernel(array $options = array()) |
67 | 94 | { |
68 | 95 | return parent::createKernel(array('test_case' => 'AutowiringTypes') + $options); |
|
0 commit comments