/** * {@inheritdoc} */ public function validate($value, Constraint $constraint) { if ($value instanceof MarketingList && !$value->isManual() && $this->isConnectedToMailChimp($value)) { $fieldValidatorConstraint = new ContactInformationColumnConstraint(); $fieldValidatorConstraint->type = ContactInformationFieldsProvider::CONTACT_INFORMATION_SCOPE_EMAIL; $this->fieldInformationValidator->validate($value->getSegment(), $fieldValidatorConstraint); } }
/** * @dataProvider submitDataProvider * @param array|null $defaultData * @param array $submittedData * @param array $expectedData * @param array $options */ public function testSubmit($defaultData, array $submittedData, array $expectedData, array $options = []) { if (count($options)) { $this->validator->expects($this->once())->method('validate')->willReturn(true); } $form = $this->factory->create($this->formType, $defaultData, $options); $this->assertEquals($defaultData, $form->getData()); $form->submit($submittedData); $this->assertTrue($form->isValid()); $data = $form->getData(); $this->assertEquals($expectedData, $data); }
public function initialize(ExecutionContext $context) { parent::initialize($context); self::$passedContext = $context; }
public function setUpMocksOnValidator(ConstraintValidator $validator) { $this->setUpMockExecutionContext(); $this->setUpMockConstraint(); $validator->initialize($this->mocks['executionContext']); }
/** * @param \Symfony\Component\Validator\ExecutionContextInterface $context */ public function initialize(ExecutionContextInterface $context) { parent::initialize($context); $this->symfonyValidator->initialize($context); }