]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix countable in tests
authorJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 18 Dec 2017 09:14:00 +0000 (10:14 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 18 Dec 2017 12:29:34 +0000 (13:29 +0100)
tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php

index 9a656dadd6c3168ea888ee814a9216fc5eba34e6..398592e1fa519577d1ff90fd4d4686c6c7d21b7d 100644 (file)
@@ -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;
     }
 }