本文整理汇总了PHP中ValidationResult::messageList方法的典型用法代码示例。如果您正苦于以下问题:PHP ValidationResult::messageList方法的具体用法?PHP ValidationResult::messageList怎么用?PHP ValidationResult::messageList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ValidationResult
的用法示例。
在下文中一共展示了ValidationResult::messageList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: combineAnd
/**
* Combine this Validation Result with the ValidationResult given in other.
* It will be valid if both this and the other result are valid.
* This object will be modified to contain the new validation information.
*/
function combineAnd(ValidationResult $other) {
$this->isValid = $this->isValid && $other->valid();
$this->errorList = array_merge($this->errorList, $other->messageList());
}
示例2: testCombineResults
/**
* Test combining validation results together
*/
public function testCombineResults()
{
$result = new ValidationResult();
$anotherresult = new ValidationResult();
$yetanotherresult = new ValidationResult();
$anotherresult->error("Eat with your mouth closed", "EATING101");
$yetanotherresult->error("You didn't wash your hands", "BECLEAN");
$this->assertTrue($result->valid());
$this->assertFalse($anotherresult->valid());
$this->assertFalse($yetanotherresult->valid());
$result->combineAnd($anotherresult)->combineAnd($yetanotherresult);
$this->assertFalse($result->valid());
$this->assertEquals(array("EATING101" => "Eat with your mouth closed", "BECLEAN" => "You didn't wash your hands"), $result->messageList());
}