vendor/bundles/JMS/SecurityExtraBundle/Tests/DependencyInjection/Compiler/SecureMethodInvocationsPass.php
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/bundles/JMS/SecurityExtraBundle/Tests/DependencyInjection/Compiler/SecureMethodInvocationsPass.php Sat Sep 24 15:40:41 2011 +0200
@@ -0,0 +1,43 @@
+<?php
+
+namespace JMS\SecurityExtraBundle\Tests\DependencyInjection\Compiler;
+
+use Symfony\Component\DependencyInjection\Definition;
+
+use JMS\SecurityExtraBundle\DependencyInjection\Compiler\SecureMethodInvocationsPass;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+
+class SecureMethodInvocationsTest extends \PHPUnit_Framework_TestCase
+{
+ public function testProcessThrowsNoExceptionForUndefinedClassIfSecureAll()
+ {
+ $container = new ContainerBuilder();
+ $container->setDefinition('security.access.method_interceptor', new Definition());
+ $container->setParameter('security.secured_services', array());
+
+ $container->setDefinition('nonexistent.class', new Definition('FooBar'));
+
+ $this->process($container);
+ }
+
+ /**
+ * @expectedException \RuntimeException
+ */
+ public function testProcessThrowsExceptionForUndefinedClassIfNotSecureAll()
+ {
+ $container = new ContainerBuilder();
+ $container->setDefinition('security.access.method_interceptor', new Definition());
+ $container->setParameter('security.secured_services', array('nonexistent.class'));
+
+ $container->setDefinition('nonexistent.class', new Definition('FooBar'));
+
+ $this->process($container);
+ }
+
+ protected function process(ContainerBuilder $container)
+ {
+ $pass = new SecureMethodInvocationsPass(sys_get_temp_dir());
+ $pass->process($container);
+ }
+}
\ No newline at end of file