From 8ef0fc4976f28c52efd9b763523d1e1cb972bf79 Mon Sep 17 00:00:00 2001 From: Johannes Schmitt Date: Thu, 28 Apr 2011 23:26:27 +0200 Subject: [PATCH] fixed unit tests --- .../Tests/Resources/config/config.yml | 2 +- .../Resources/config/schema/symfony-1.0.xsd | 14 +------------- .../Fixtures/php/validation_annotations.php | 6 +----- .../Fixtures/xml/validation_annotations.xml | 4 +--- .../Fixtures/yml/validation_annotations.yml | 4 +--- .../DependencyInjection/FrameworkExtensionTest.php | 12 ++++++++---- 6 files changed, 13 insertions(+), 29 deletions(-) diff --git a/src/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml b/src/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml index e0521cbf73..f8092fd121 100644 --- a/src/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml +++ b/src/Symfony/Bundle/AsseticBundle/Tests/Resources/config/config.yml @@ -5,7 +5,7 @@ framework: csrf_protection: enabled: true router: { resource: "%kernel.root_dir%/config/routing.yml" } - validation: { enabled: true, annotations: true } + validation: { enabled: true, enable_annotations: true } templating: { engines: ['twig', 'php'] } session: default_locale: en diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index bdc3addf80..b9a90b87c8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -114,20 +114,8 @@ - - - - - - - - - - - - - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php index 4268fbe35c..75c8f48d49 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/validation_annotations.php @@ -4,10 +4,6 @@ $container->loadFromExtension('framework', array( 'secret' => 's3cr3t', 'validation' => array( 'enabled' => true, - 'annotations' => array( - 'namespaces' => array( - 'app' => 'Application\\Validator\\Constraints\\', - ), - ), + 'enable_annotations' => true, ), )); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml index 191daf6181..22f1536e13 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/validation_annotations.xml @@ -7,8 +7,6 @@ http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"> - - Application\Validator\Constraints\ - + diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml index 345808c689..41f17969b8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/validation_annotations.yml @@ -2,6 +2,4 @@ framework: secret: s3cr3t validation: enabled: true - annotations: - namespaces: - app: Application\Validator\Constraints\ + enable_annotations: true diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 6f3382b464..8e3113ff0e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -166,10 +166,14 @@ abstract class FrameworkExtensionTest extends TestCase $container = $this->createContainerFromFile('validation_annotations'); $this->assertTrue($container->hasDefinition('validator.mapping.loader.annotation_loader'), '->registerValidationConfiguration() defines the annotation loader'); - - $argument = $container->getDefinition('validator.mapping.loader.annotation_loader')->getArgument(0); - $this->assertEquals('Symfony\\Component\\Validator\\Constraints\\', $argument['assert'], '->registerValidationConfiguration() loads the default "assert" prefix'); - $this->assertEquals('Application\\Validator\\Constraints\\', $argument['app'], '->registerValidationConfiguration() loads custom validation namespaces'); + $loaders = $container->getDefinition('validator.mapping.loader.loader_chain')->getArgument(0); + $found = false; + foreach ($loaders as $loader) { + if ('validator.mapping.loader.annotation_loader' === (string) $loader) { + $found = true; + } + } + $this->assertTrue($found, 'validator.mapping.loader.annotation_loader is added to the loader chain.'); } public function testValidationPaths()