|
12 | 12 | namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints;
|
13 | 13 |
|
14 | 14 | use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
|
| 15 | +use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory; |
15 | 16 | use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity;
|
16 | 17 | use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleIdentEntity;
|
17 | 18 | use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIdentEntity;
|
@@ -93,17 +94,6 @@ protected function createEntityManagerMock($repositoryMock)
|
93 | 94 | return $em;
|
94 | 95 | }
|
95 | 96 |
|
96 |
| - protected function createMetadataFactoryMock($metadata) |
97 |
| - { |
98 |
| - $metadataFactory = $this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface'); |
99 |
| - $metadataFactory->expects($this->any()) |
100 |
| - ->method('getClassMetadata') |
101 |
| - ->with($this->equalTo($metadata->name)) |
102 |
| - ->will($this->returnValue($metadata)); |
103 |
| - |
104 |
| - return $metadataFactory; |
105 |
| - } |
106 |
| - |
107 | 97 | protected function createValidatorFactory($uniqueValidator)
|
108 | 98 | {
|
109 | 99 | $validatorFactory = $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface');
|
@@ -138,7 +128,8 @@ public function createValidator($entityManagerName, $em, $validateClass = null,
|
138 | 128 | ));
|
139 | 129 | $metadata->addConstraint($constraint);
|
140 | 130 |
|
141 |
| - $metadataFactory = $this->createMetadataFactoryMock($metadata); |
| 131 | + $metadataFactory = new FakeMetadataFactory(); |
| 132 | + $metadataFactory->addMetadata($metadata); |
142 | 133 | $validatorFactory = $this->createValidatorFactory($uniqueValidator);
|
143 | 134 |
|
144 | 135 | return new Validator($metadataFactory, $validatorFactory);
|
|
0 commit comments