|
@@ -163,12 +163,19 @@ class ExplainAdminCommandTest extends \PHPUnit_Framework_TestCase
|
|
|
->with($this->equalTo('Acme\Entity\Foo'))
|
|
|
->will($this->returnValue($metadata));
|
|
|
|
|
|
- $propertyMetadata = $this->getMockForAbstractClass('Symfony\Component\Validator\Mapping\ElementMetadata');
|
|
|
- $propertyMetadata->constraints = array(new NotNull(), new Length(array('min' => 2, 'max' => 50, 'groups' => array('create', 'edit'))));
|
|
|
+ if (class_exists('Symfony\Component\Validator\Mapping\GenericMetadata')) {
|
|
|
+ $class = 'GenericMetadata';
|
|
|
+ } else {
|
|
|
+ // Symfony <2.5 compatibility
|
|
|
+ $class = 'ElementMetadata';
|
|
|
+ }
|
|
|
+
|
|
|
+ $propertyMetadata = $this->getMockForAbstractClass('Symfony\Component\Validator\Mapping\\'.$class);
|
|
|
+ $propertyMetadata->constraints = array(new NotNull(), new Length(array('min' => 2, 'max' => 50, 'groups' => array('create', 'edit'),)));
|
|
|
$metadata->properties = array('firstName' => $propertyMetadata);
|
|
|
|
|
|
- $getterMetadata = $this->getMockForAbstractClass('Symfony\Component\Validator\Mapping\ElementMetadata');
|
|
|
- $getterMetadata->constraints = array(new NotNull(), new Email(array('groups' => array('registration', 'edit'))));
|
|
|
+ $getterMetadata = $this->getMockForAbstractClass('Symfony\Component\Validator\Mapping\\'.$class);
|
|
|
+ $getterMetadata->constraints = array(new NotNull(), new Email(array('groups' => array('registration', 'edit'),)));
|
|
|
$metadata->getters = array('email' => $getterMetadata);
|
|
|
|
|
|
$modelManager = $this->getMock('Sonata\AdminBundle\Model\ModelManagerInterface');
|