lithium\tests\cases\data\ModelTest::testSaveWithValidationAndWhitelist PHP Метод

testSaveWithValidationAndWhitelist() публичный Метод

    public function testSaveWithValidationAndWhitelist()
    {
        $post = MockPostForValidates::create();
        $whitelist = array('title');
        $post->title = 'title';
        $result = $post->save(null, compact('whitelist'));
        $this->assertTrue($result);
        $post->title = '';
        $result = $post->save(null, 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