lithium\tests\cases\data\ModelTest::testValidatesWithWhitelist PHP Method

testValidatesWithWhitelist() public method

    public function testValidatesWithWhitelist()
    {
        $post = MockPostForValidates::create();
        $whitelist = array('title');
        $post->title = 'title';
        $result = $post->validates(compact('whitelist'));
        $this->assertTrue($result);
        $post->title = '';
        $result = $post->validates(compact('whitelist'));
        $this->assertFalse($result);
        $result = $post->errors();
        $this->assertNotEmpty($result);
        $expected = array('title' => array('please enter a title'));
        $result = $post->errors();
        $this->assertEqual($expected, $result);
    }
ModelTest