8000 [DoctrineBridge] Adapted UniqueValidator to latest changes in the Val… · symfony/symfony@1f752e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1f752e8

Browse files
committed
[DoctrineBridge] Adapted UniqueValidator to latest changes in the Validator
1 parent efe42cb commit 1f752e8

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints;
1313

1414
use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
15+
use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory;
1516
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity;
1617
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleIdentEntity;
1718
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIdentEntity;
@@ -93,17 +94,6 @@ protected function createEntityManagerMock($repositoryMock)
9394
return $em;
9495
}
9596

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-
10797
protected function createValidatorFactory($uniqueValidator)
10898
{
10999
$validatorFactory = $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface');
@@ -138,7 +128,8 @@ public function createValidator($entityManagerName, $em, $validateClass = null,
138128
));
139129
$metadata->addConstraint($constraint);
140130

141-
$metadataFactory = $this->createMetadataFactoryMock($metadata);
131+
$metadataFactory = new FakeMetadataFactory();
132+
$metadataFactory->addMetadata($metadata);
142133
$validatorFactory = $this->createValidatorFactory($uniqueValidator);
143134

144135
return new Validator($metadataFactory, $validatorFactory);

0 commit comments

Comments
 (0)
0