Skip to content

Commit

Permalink
[Form] updated ValidatorExtension to avoid using a deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Jan 24, 2013
1 parent 9e8b2f0 commit 5923f8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Expand Up @@ -36,7 +36,7 @@ public function __construct(ValidatorInterface $validator)
// code must be kept synchronized with validation.xml

/** @var \Symfony\Component\Validator\Mapping\ClassMetadata $metadata */
$metadata = $this->validator->getMetadataFactory()->getClassMetadata('Symfony\Component\Form\Form');
$metadata = $this->validator->getMetadataFactory()->getMetadataFor('Symfony\Component\Form\Form');
$metadata->addConstraint(new Form());
$metadata->addPropertyConstraint('children', new Valid());
}
Expand Down
Expand Up @@ -25,10 +25,10 @@ protected function setUp()
}

$this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
$metadataFactory = $this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface');
$metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
$this->validator->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
$metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$metadataFactory->expects($this->once())->method('getClassMetadata')->will($this->returnValue($metadata));
$metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));

parent::setUp();
}
Expand Down

0 comments on commit 5923f8b

Please sign in to comment.