createTestConfigurationWithXmlLoader example

$this->assertCount(0, $enumStringMetadata); // asserts the length constraint is not added to an enum     }

    public function testFieldMappingsConfiguration()
    {
        $validator = Validation::createValidatorBuilder()
            ->enableAttributeMapping()
            ->addXmlMappings([__DIR__.'/../Resources/validator/BaseUser.xml'])
            ->addLoader(
                new DoctrineLoader(
                    DoctrineTestHelper::createTestEntityManager(
                        DoctrineTestHelper::createTestConfigurationWithXmlLoader()
                    ), '{}'
                )
            )
            ->getValidator();

        $classMetadata = $validator->getMetadataFor(new BaseUser(1, 'DemoUser'));

        $constraints = $classMetadata->getConstraints();
        $this->assertCount(0, $constraints);
    }

    
Home | Imprint | This part of the site doesn't use cookies.