diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml index bbcae99853aa2..c7295538e90f3 100644 --- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml +++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security.xml @@ -107,6 +107,8 @@ + + Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php new file mode 100644 index 0000000000000..07941a3ff857e --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/AutowiringTypesTest.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\Functional; + +class AutowiringTypesTest extends WebTestCase +{ + public function testAccessDecisionManagerAutowiring() + { + static::bootKernel(array('debug' => false)); + $container = static::$kernel->getContainer(); + + $accessDecisionManager = $container->get('test.autowiring_types.autowired_services')->getAccessDecisionManager(); + $this->assertInstanceOf('Symfony\Component\Security\Core\Authorization\AccessDecisionManager', $accessDecisionManager); + } + + public function testDebugAccessDecisionManagerAutowiring() + { + static::bootKernel(array('debug' => true)); + $container = static::$kernel->getContainer(); + + $accessDecisionManager = $container->get('test.autowiring_types.autowired_services')->getAccessDecisionManager(); + $this->assertInstanceOf('Symfony\Component\Security\Core\Authorization\AccessDecisionManager', $accessDecisionManager); + } + + protected static function createKernel(array $options = array()) + { + return parent::createKernel(array('test_case' => 'AutowiringTypes') + $options); + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php new file mode 100644 index 0000000000000..eabae2332ab96 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/AutowiringTypes/AutowiredServices.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle\AutowiringTypes; + +use Symfony\Component\Security\Core\Authorization\AccessDecisionManagerInterface; + +class AutowiredServices +{ + private $accessDecisionManager; + + public function __construct(AccessDecisionManagerInterface $accessDecisionManager) + { + $this->accessDecisionManager = $accessDecisionManager; + } + + public function getAccessDecisionManager() + { + return $this->accessDecisionManager; + } +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php new file mode 100644 index 0000000000000..d2af1a40ff215 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle; + +use Symfony\Component\HttpKernel\Bundle\Bundle; + +class TestBundle extends Bundle +{ +} diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/bundles.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/bundles.php new file mode 100644 index 0000000000000..b254425b54352 --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/bundles.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), + new Symfony\Bundle\SecurityBundle\SecurityBundle(), + new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle\TestBundle(), +); diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/config.yml new file mode 100644 index 0000000000000..3f54991ef2bab --- /dev/null +++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/AutowiringTypes/config.yml @@ -0,0 +1,18 @@ +imports: + - { resource: ../config/framework.yml } + + +security: + providers: + in_memory: + memory: ~ + + firewalls: + test: + pattern: ^/ + security: false + +services: + test.autowiring_types.autowired_services: + class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle\AutowiringTypes\AutowiredServices + autowire: true