Skip to content

Commit 2e72aa0

Browse files
committed
fix mocks
* check for existance of `setMetadataFactory()` method (this is needed for tests run with deps=high as the method was removed in Symfony 3.0) * fix mock testing the `EngineInterface` as the `stream()` method cannot be mocked when it is does not exist in the mocked interface
1 parent 779e9c9 commit 2e72aa0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tests/Extension/Validator/ValidatorExtensionTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\Form\Tests\Extension\Validator;
1313

1414
use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
15+
use Symfony\Component\Validator\ValidatorInterface;
1516

1617
class ValidatorExtensionTest extends \PHPUnit_Framework_TestCase
1718
{
@@ -38,9 +39,11 @@ public function test2Dot5ValidationApi()
3839
->method('addPropertyConstraint')
3940
->with('children', $this->isInstanceOf('Symfony\Component\Validator\Constraints\Valid'));
4041

41-
$validator
42-
->expects($this->never())
43-
->method('getMetadataFactory');
42+
if ($validator instanceof ValidatorInterface) {
43+
$validator
44+
->expects($this->never())
45+
->method('getMetadataFactory');
46+
}
4447

4548
$extension = new ValidatorExtension($validator);
4649
$guesser = $extension->loadTypeGuesser();

0 commit comments

Comments
 (0)