コード例 #1
0
 public function testNotExistingFormData()
 {
     $formConfig = $this->getMock('\\Symfony\\Component\\Form\\FormConfigInterface');
     $form = new Form($formConfig);
     $this->context = $this->getMock('\\Symfony\\Component\\Validator\\ExecutionContextInterface');
     $this->context->expects($this->any())->method('getRoot')->will($this->returnValue($form));
     $this->validator->initialize($this->context);
     $this->assertNull($this->validator->validate(false, $this->constraint));
 }
コード例 #2
0
 public function testInvalidData()
 {
     $this->formField->expects($this->any())->method('getData')->will($this->returnValue($this->dateTimeStart));
     $this->context->expects($this->once())->method('addViolation')->with($this->equalTo($this->constraint->message), $this->equalTo(array('{{ ' . $this->constraint->getDefaultOption() . ' }}' => $this->constraint->field)));
     $this->validator->validate($this->dateTimeEnd, $this->constraint);
 }