|
8 | 8 | use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
9 | 9 | use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
10 | 10 | use Symfony\Component\Security\Core\Role\Role;
|
| 11 | +use Symfony\Component\Security\Core\Role\RoleHierarchy; |
| 12 | +use Symfony\Component\Validator\ConstraintViolation; |
| 13 | +use Symfony\Component\Validator\ConstraintViolationList; |
11 | 14 | use Symfony\Component\Validator\Validator\ValidatorInterface;
|
12 | 15 | use Symfony\Component\Workflow\Event\GuardEvent;
|
13 | 16 | use Symfony\Component\Workflow\EventListener\ExpressionLanguage;
|
@@ -41,7 +44,8 @@ protected function setUp()
|
41 | 44 | $this->authenticationChecker = $this->getMockBuilder(AuthorizationCheckerInterface::class)->getMock();
|
42 | 45 | $trustResolver = $this->getMockBuilder(AuthenticationTrustResolverInterface::class)->getMock();
|
43 | 46 | $this->validator = $this->getMockBuilder(ValidatorInterface::class)->getMock();
|
44 |
| - $this->listener = new GuardListener($this->configuration, $expressionLanguage, $tokenStorage, $this->authenticationChecker, $trustResolver, null, $this->validator); |
| 47 | + $roleHierarchy = new RoleHierarchy([]); |
| 48 | + $this->listener = new GuardListener($this->configuration, $expressionLanguage, $tokenStorage, $this->authenticationChecker, $trustResolver, $roleHierarchy, $this->validator); |
45 | 49 | }
|
46 | 50 |
|
47 | 51 | protected function tearDown()
|
@@ -170,7 +174,7 @@ private function configureValidator($isUsed, $valid = true)
|
170 | 174 | $this->validator
|
171 | 175 | ->expects($this->once())
|
172 | 176 | ->method('validate')
|
173 |
| - ->willReturn($valid ? [] : ['a violation']) |
| 177 | + ->willReturn(new ConstraintViolationList($valid ? [] : [new ConstraintViolation('a violation', null, [], '', null, '')])) |
174 | 178 | ;
|
175 | 179 | }
|
176 | 180 | }
|
0 commit comments