lithium\tests\cases\util\ValidatorTest::testCheckSkipEmpty PHP Method

testCheckSkipEmpty() public method

public testCheckSkipEmpty ( )
    public function testCheckSkipEmpty()
    {
        $rules = array('email' => array('email', 'skipEmpty' => true, 'message' => 'email is not valid'));
        // empty string should pass
        $data = array('email' => '');
        $result = Validator::check($data, $rules);
        $this->assertEmpty($result);
        // null value should pass
        $data = array('email' => null);
        $result = Validator::check($data, $rules);
        $this->assertEmpty($result);
        // string with spaces should NOT pass
        $data = array('email' => ' ');
        $result = Validator::check($data, $rules);
        $this->assertNotEmpty($result);
    }