symfony_example_app/tests/Validator/ValidatorTestCase.php

20 lines
532 B
PHP
Raw Normal View History

<?php
namespace App\Tests\Validator;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
abstract class ValidatorTestCase extends TestCase
{
protected function createExecutionContext(bool $violation): ExecutionContextInterface {
$expected = $violation ? $this->once() : $this->never();
$context = $this->createMock(ExecutionContextInterface::class);
$context->expects($expected)
->method('buildViolation');
return $context;
}
}