Skip to content

Commit ca9a551

Browse files
flugteohhanhui
authored andcommitted
fix tests
1 parent 788f203 commit ca9a551

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/Bridge/Symfony/Validator/EventListener/ValidationExceptionListenerTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ class ValidationExceptionListenerTest extends TestCase
3131
public function testNotValidationException()
3232
{
3333
$eventProphecy = $this->prophesize(ExceptionEvent::class);
34-
$eventProphecy->getException()->willReturn(new \Exception())->shouldBeCalled();
34+
if(method_exists(ExceptionEvent::class, 'getException')){
35+
$eventProphecy->getException()->willReturn(new \Exception())->shouldBeCalled();
36+
}else {
37+
$eventProphecy->getThrowable()->willReturn(new \Exception())->shouldBeCalled();
38+
}
3539
$eventProphecy->setResponse()->shouldNotBeCalled();
3640

3741
$serializerProphecy = $this->prophesize(SerializerInterface::class);
@@ -46,7 +50,11 @@ public function testValidationException()
4650
$list = new ConstraintViolationList([]);
4751

4852
$eventProphecy = $this->prophesize(ExceptionEvent::class);
49-
$eventProphecy->getException()->willReturn(new ValidationException($list))->shouldBeCalled();
53+
if(method_exists(ExceptionEvent::class, 'getException')){
54+
$eventProphecy->getException()->willReturn(new ValidationException($list))->shouldBeCalled();
55+
}else {
56+
$eventProphecy->getThrowable()->willReturn(new ValidationException($list))->shouldBeCalled();
57+
}
5058
$eventProphecy->getRequest()->willReturn(new Request())->shouldBeCalled();
5159
$eventProphecy->setResponse(Argument::allOf(
5260
Argument::type(Response::class),

0 commit comments

Comments
 (0)