Esempio n. 1
0
 /**
  * If the user select "Yes, I have a password", we check the password.
  */
 public function verifyAccount($value, ExecutionContextInterface $context)
 {
     if ($value == 1) {
         $data = $context->getRoot()->getData();
         if (false === $data['password'] || empty($data['password']) && '0' != $data['password']) {
             $context->getViolations()->add(new ConstraintViolation(Translator::getInstance()->trans('This value should not be blank.'), 'account_password', array(), $context->getRoot(), 'children[password].data', 'propertyPath'));
         }
     }
 }
 public function assertRaised()
 {
     $expected = array();
     foreach ($this->assertions as $assertion) {
         $expected[] = $assertion->getViolation();
     }
     $expected[] = $this->getViolation();
     $violations = iterator_to_array($this->context->getViolations());
     \PHPUnit_Framework_Assert::assertCount(count($expected), $violations);
     reset($violations);
     foreach ($expected as $violation) {
         \PHPUnit_Framework_Assert::assertEquals($violation, current($violations));
         next($violations);
     }
 }