mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 23:23:51 +00:00
remove deprecation on PersonHasCenterValidator and fix tests
This commit is contained in:
@@ -12,10 +12,11 @@ declare(strict_types=1);
|
||||
namespace Validator\Person;
|
||||
|
||||
use Chill\MainBundle\Entity\Center;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverDispatcherInterface;
|
||||
use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface;
|
||||
use Chill\PersonBundle\Entity\Person;
|
||||
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenter;
|
||||
use Chill\PersonBundle\Validator\Constraints\Person\PersonHasCenterValidator;
|
||||
use Prophecy\Argument;
|
||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
|
||||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
|
||||
|
||||
@@ -52,9 +53,18 @@ class PersonHasCenterValidatorTest extends ConstraintValidatorTestCase
|
||||
],
|
||||
]);
|
||||
|
||||
$centerResolverDispatcher = $this->createMock(CenterResolverDispatcherInterface::class);
|
||||
$prophecy = $this->prophesize(CenterResolverManagerInterface::class);
|
||||
$prophecy->resolveCenters(Argument::type(Person::class), Argument::any())->will(function ($args) {
|
||||
$center = $args[0]->getCenter();
|
||||
|
||||
return new PersonHasCenterValidator($parameterBag, $centerResolverDispatcher);
|
||||
if ($center instanceof Center) {
|
||||
return [$center];
|
||||
}
|
||||
|
||||
return [];
|
||||
});
|
||||
|
||||
return new PersonHasCenterValidator($parameterBag, $prophecy->reveal());
|
||||
}
|
||||
|
||||
protected function getConstraint()
|
||||
|
Reference in New Issue
Block a user