Programming Language PHP
Namespace Oro\Bundle\ContactUsBundle\Validator
Class ContactRequestCallbackValidator
Total Examples 1
1 code examples of PHP Oro\Bundle\ContactUsBundle\Validator\ContactRequestCallbackValidator extracted from open source projects
/**
* @dataProvider validationDataProvider
*/
public function testValidationCallback(
?string $phone,
?string $email,
string $method,
int $expectedViolationCount
): void {
$request = new ContactRequest();
$request->setPhone($phone);
$request->setEmailAddress($email);
$request->setPreferredContactMethod($method);
$builder = $this->createMock(ConstraintViolationBuilderInterface::class);
$builder->expects($this->exactly($expectedViolationCount))
->method('atPath')
->willReturnSelf();
$builder->expects($this->exactly($expectedViolationCount))
->method('addViolation');
$context = $this->createMock(ExecutionContextInterface::class);
$context->expects($this->exactly($expectedViolationCount))
->method('buildViolation')
->willReturn($builder);
ContactRequestCallbackValidator::validate($request, $context);
}