本文整理汇总了PHP中TestController::validateErrors方法的典型用法代码示例。如果您正苦于以下问题:PHP TestController::validateErrors方法的具体用法?PHP TestController::validateErrors怎么用?PHP TestController::validateErrors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestController
的用法示例。
在下文中一共展示了TestController::validateErrors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidateErrorsOnArbitraryModels
/**
* test that validateErrors works with any old model.
*
* @return void
*/
public function testValidateErrorsOnArbitraryModels()
{
$TestController = new TestController();
$Post = new ControllerPost();
$Post->validate = array('title' => 'notEmpty');
$Post->set('title', '');
$result = $TestController->validateErrors($Post);
$expected = array('title' => array('This field cannot be left blank'));
$this->assertEquals($expected, $result);
}
示例2: testValidateErrors
/**
* testValidateErrors method
*
* @access public
* @return void
*/
function testValidateErrors()
{
$TestController = new TestController();
$TestController->constructClasses();
$this->assertFalse($TestController->validateErrors());
$this->assertEqual($TestController->validate(), 0);
$TestController->ControllerComment->invalidate('some_field', 'error_message');
$TestController->ControllerComment->invalidate('some_field2', 'error_message2');
$comment = new ControllerComment();
$comment->set('someVar', 'data');
$result = $TestController->validateErrors($comment);
$expected = array('some_field' => 'error_message', 'some_field2' => 'error_message2');
$this->assertIdentical($result, $expected);
$this->assertEqual($TestController->validate($comment), 2);
}