Author: Bernhard Schussek (bschussek@gmail.com)
Inheritance: implements Symfony\Component\Validator\ConstraintValidatorInterface
コード例 #1
0
 /**
  * {@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);
     }
 }
コード例 #2
0
 /**
  * @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);
 }
コード例 #3
0
 public function initialize(ExecutionContext $context)
 {
     parent::initialize($context);
     self::$passedContext = $context;
 }
コード例 #4
0
 public function setUpMocksOnValidator(ConstraintValidator $validator)
 {
     $this->setUpMockExecutionContext();
     $this->setUpMockConstraint();
     $validator->initialize($this->mocks['executionContext']);
 }
コード例 #5
0
 /**
  * @param \Symfony\Component\Validator\ExecutionContextInterface $context
  */
 public function initialize(ExecutionContextInterface $context)
 {
     parent::initialize($context);
     $this->symfonyValidator->initialize($context);
 }