Respect\Validation\Rules\Not::assert PHP Method

assert() public method

public assert ( $input )
    public function assert($input)
    {
        if ($this->validate($input)) {
            return true;
        }
        $rule = $this->rule;
        if ($rule instanceof AllOf) {
            $rule = $this->absorbAllOf($rule, $input);
        }
        throw $rule->reportError($input)->setMode(ValidationException::MODE_NEGATIVE);
    }

Usage Example

示例#1
0
 /**
  * @dataProvider providerForInvalidNot
  * @expectedException Respect\Validation\Exceptions\ValidationException
  */
 public function testNotNotHaha($v, $input)
 {
     $not = new Not($v);
     $this->assertFalse($not->assert($input));
 }