Programming Language PHP

Namespace Oro\Bundle\ContactUsBundle\Validator

Class ContactRequestCallbackValidator

Method/Function validate

Total Examples 1

1 code examples of PHP Oro\Bundle\ContactUsBundle\Validator\ContactRequestCallbackValidator::validate extracted from open source projects

Was this example useful?
0
                                                    /**
     * @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);
    }
                                            
ContactRequestCallbackValidator's Other Methods