浏览代码

fixed unit tests

Johannes Schmitt 14 年之前
父节点
当前提交
8ef0fc4976

+ 1 - 1
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

+ 1 - 13
src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

@@ -114,20 +114,8 @@
     </xsd:complexType>
 
     <xsd:complexType name="validation">
-        <xsd:sequence>
-            <xsd:element name="namespace" type="validation_namespace" minOccurs="0" maxOccurs="1" />
-        </xsd:sequence>
-
         <xsd:attribute name="enabled" type="xsd:boolean" />
         <xsd:attribute name="cache" type="xsd:string" />
-        <xsd:attribute name="annotations" type="xsd:boolean" />
-    </xsd:complexType>
-
-    <xsd:complexType name="validation_namespace">
-        <xsd:simpleContent>
-            <xsd:extension base="xsd:string">
-                <xsd:attribute name="prefix" type="xsd:string" />
-            </xsd:extension>
-        </xsd:simpleContent>
+        <xsd:attribute name="enable-annotations" type="xsd:boolean" />
     </xsd:complexType>
 </xsd:schema>

+ 1 - 5
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,
     ),
 ));

+ 1 - 3
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">
 
     <framework:config secret="s3cr3t">
-        <framework:validation enabled="true" annotations="true">
-            <framework:namespace prefix="app">Application\Validator\Constraints\</framework:namespace>
-        </framework:validation>
+        <framework:validation enabled="true" enable-annotations="true" />
     </framework:config>
 </container>

+ 1 - 3
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

+ 8 - 4
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()