8000 [Validator] Refactored the Validator for use in Drupal by webmozart · Pull Request #6096 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Validator] Refactored the Validator for use in Drupal #6096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 24, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[DoctrineBridge] Adapted UniqueValidator to latest changes in the Val…
…idator
  • Loading branch information
webmozart committed Nov 24, 2012
commit 1f752e866e3961e623fc53e5996b35671cf4bb89
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Bridge\Doctrine\Tests\Validator\Constraints;

use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase;
use Symfony\Component\Validator\Tests\Fixtures\FakeMetadataFactory;
use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoubleIdentEntity;
use Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIdentEntity;
Expand Down Expand Up @@ -93,17 +94,6 @@ protected function createEntityManagerMock($repositoryMock)
return $em;
}

protected function createMetadataFactoryMock($metadata)
{
$metadataFactory = $this->getMock('Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface');
$metadataFactory->expects($this->any())
->method('getClassMetadata')
->with($this->equalTo($metadata->name))
->will($this->returnValue($metadata));

return $metadataFactory;
}

protected function createValidatorFactory($uniqueValidator)
{
$validatorFactory = $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface');
Expand Down Expand Up @@ -138,7 +128,8 @@ public function createValidator($entityManagerName, $em, $validateClass = null,
));
$metadata->addConstraint($constraint);

$metadataFactory = $this->createMetadataFactoryMock($metadata);
$metadataFactory = new FakeMetadataFactory();
$metadataFactory->addMetadata($metadata);
$validatorFactory = $this->createValidatorFactory($uniqueValidator);

return new Validator($metadataFactory, $validatorFactory);
Expand Down
0