Author: Jan Pěček
Author: Jaroslav Hanslík
Exemplo n.º 1
0
 /**
  * Checks if the condition is fulfilled.
  *
  * @param mixed $value Input value
  * @return boolean
  */
 private function checkCondition($value)
 {
     if (null === $this->condValidator) {
         // There is no validator -> always fulfilled
         return true;
     }
     return $this->condValidator->isValid($value);
 }
Exemplo n.º 2
0
 /**
  * Tests right values.
  *
  * @param \Jyxo\Input\ValidatorInterface $validator Validator
  * @param array $good Right values
  * @param array $wrong Wrong values
  */
 private function executeTests(\Jyxo\Input\ValidatorInterface $validator, array $good, array $wrong)
 {
     foreach ($good as $value) {
         $this->assertTrue($validator->isValid($value), sprintf('Tests of value %s should be true but is false.', $value));
     }
     foreach ($wrong as $value) {
         $this->assertFalse($validator->isValid($value), sprintf('Tests of value %s should be false but is true.', $value));
     }
 }