From 5661e8d42af5d0557bf8017b515c51335757d6f2 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 18 Dec 2017 10:14:00 +0100 Subject: [PATCH] Fix countable in tests --- .../CoreBundle/Helper/ContentProxyTest.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php index 9a656dad..398592e1 100644 --- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php +++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php @@ -221,7 +221,7 @@ class ContentProxyTest extends TestCase $tagger->expects($this->once()) ->method('tag'); - $validator = $this->getValidator(); + $validator = $this->getValidator(false); $validator->expects($this->once()) ->method('validate') ->willReturn(new ConstraintViolationList([new ConstraintViolation('oops', 'oops', [], 'oops', 'language', 'dontexist')])); @@ -262,7 +262,7 @@ class ContentProxyTest extends TestCase $tagger->expects($this->once()) ->method('tag'); - $validator = $this->getValidator(); + $validator = $this->getValidator(false); $validator->expects($this->exactly(2)) ->method('validate') ->will($this->onConsecutiveCalls( @@ -545,11 +545,19 @@ class ContentProxyTest extends TestCase return new NullLogger(); } - private function getValidator() + private function getValidator($withDefaultMock = true) { - return $this->getMockBuilder(RecursiveValidator::class) + $mock = $this->getMockBuilder(RecursiveValidator::class) ->setMethods(['validate']) ->disableOriginalConstructor() ->getMock(); + + if ($withDefaultMock) { + $mock->expects($this->any()) + ->method('validate') + ->willReturn(new ConstraintViolationList()); + } + + return $mock; } } -- 2.41.0