Merge branch '4.0'
* 4.0: [Security] register custom providers on ExpressionLanguage directly [PhpUnitBridge] Catch deprecation error handler
This commit is contained in:
commit
5b4e1c5b6b
@ -118,7 +118,7 @@ class DeprecationErrorHandler
|
||||
}
|
||||
|
||||
if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
|
||||
if (isset($trace[$i]['class']) && in_array($trace[$i]['class'], array('Symfony\Bridge\PhpUnit\SymfonyTestsListener', 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListener'), true)) {
|
||||
if (isset($trace[$i]['class']) && 0 === strpos($trace[$i]['class'], 'Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerFor')) {
|
||||
$parsedMsg = unserialize($msg);
|
||||
$msg = $parsedMsg['deprecation'];
|
||||
$class = $parsedMsg['class'];
|
||||
@ -216,7 +216,7 @@ class DeprecationErrorHandler
|
||||
|
||||
$groups = array('unsilenced', 'remaining');
|
||||
if (DeprecationErrorHandler::MODE_WEAK_VENDORS === $mode) {
|
||||
$groups[] = 'remaining vendor';
|
||||
$groups[] = 'remaining vendor';
|
||||
}
|
||||
array_push($groups, 'legacy', 'other');
|
||||
|
||||
|
@ -36,10 +36,10 @@ class AddExpressionLanguageProvidersPass implements CompilerPassInterface
|
||||
}
|
||||
|
||||
// security
|
||||
if ($container->has('security.access.expression_voter')) {
|
||||
$definition = $container->findDefinition('security.access.expression_voter');
|
||||
if ($container->has('security.expression_language')) {
|
||||
$definition = $container->findDefinition('security.expression_language');
|
||||
foreach ($container->findTaggedServiceIds('security.expression_language_provider', true) as $id => $attributes) {
|
||||
$definition->addMethodCall('addExpressionLanguageProvider', array(new Reference($id)));
|
||||
$definition->addMethodCall('registerProvider', array(new Reference($id)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ class AddExpressionLanguageProvidersPassTest extends TestCase
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
||||
|
||||
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider');
|
||||
$definition = new Definition('\stdClass');
|
||||
$definition->addTag('routing.expression_language_provider');
|
||||
$container->setDefinition('some_routing_provider', $definition->setPublic(true));
|
||||
|
||||
@ -43,7 +43,7 @@ class AddExpressionLanguageProvidersPassTest extends TestCase
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
||||
|
||||
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider');
|
||||
$definition = new Definition('\stdClass');
|
||||
$definition->addTag('routing.expression_language_provider');
|
||||
$container->setDefinition('some_routing_provider', $definition->setPublic(true));
|
||||
|
||||
@ -63,17 +63,16 @@ class AddExpressionLanguageProvidersPassTest extends TestCase
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
||||
|
||||
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider');
|
||||
$definition = new Definition('\stdClass');
|
||||
$definition->addTag('security.expression_language_provider');
|
||||
$container->setDefinition('some_security_provider', $definition->setPublic(true));
|
||||
|
||||
$container->register('security.access.expression_voter', '\stdClass')->setPublic(true);
|
||||
$container->register('security.expression_language', '\stdClass')->setPublic(true);
|
||||
$container->compile();
|
||||
|
||||
$router = $container->getDefinition('security.access.expression_voter');
|
||||
$calls = $router->getMethodCalls();
|
||||
$calls = $container->getDefinition('security.expression_language')->getMethodCalls();
|
||||
$this->assertCount(1, $calls);
|
||||
$this->assertEquals('addExpressionLanguageProvider', $calls[0][0]);
|
||||
$this->assertEquals('registerProvider', $calls[0][0]);
|
||||
$this->assertEquals(new Reference('some_security_provider'), $calls[0][1][0]);
|
||||
}
|
||||
|
||||
@ -82,22 +81,17 @@ class AddExpressionLanguageProvidersPassTest extends TestCase
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());
|
||||
|
||||
$definition = new Definition('Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\TestProvider');
|
||||
$definition = new Definition('\stdClass');
|
||||
$definition->addTag('security.expression_language_provider');
|
||||
$container->setDefinition('some_security_provider', $definition->setPublic(true));
|
||||
|
||||
$container->register('my_security.access.expression_voter', '\stdClass')->setPublic(true);
|
||||
$container->setAlias('security.access.expression_voter', 'my_security.access.expression_voter');
|
||||
$container->register('my_security.expression_language', '\stdClass')->setPublic(true);
|
||||
$container->setAlias('security.expression_language', 'my_security.expression_language');
|
||||
$container->compile();
|
||||
|
||||
$router = $container->getDefinition('my_security.access.expression_voter');
|
||||
$calls = $router->getMethodCalls();
|
||||
$calls = $container->getDefinition('my_security.expression_language')->getMethodCalls();
|
||||
$this->assertCount(1, $calls);
|
||||
$this->assertEquals('addExpressionLanguageProvider', $calls[0][0]);
|
||||
$this->assertEquals('registerProvider', $calls[0][0]);
|
||||
$this->assertEquals(new Reference('some_security_provider'), $calls[0][1][0]);
|
||||
}
|
||||
}
|
||||
|
||||
class TestProvider
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user