20 lines
		
	
	
		
			532 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			532 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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;
 | 
						|
    }
 | 
						|
}
 |