本文整理匯總了PHP中Key::check方法的典型用法代碼示例。如果您正苦於以下問題:PHP Key::check方法的具體用法?PHP Key::check怎麽用?PHP Key::check使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Key
的用法示例。
在下文中一共展示了Key::check方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testArrayWithPresentKeyShouldReturnTrue
public function testArrayWithPresentKeyShouldReturnTrue()
{
$validator = new Key('bar');
$obj = array();
$obj['bar'] = 'foo';
$this->assertTrue($validator->assert($obj));
$this->assertTrue($validator->check($obj));
$this->assertTrue($validator->validate($obj));
}
示例2: test_array_with_present_key_should_return_true
public function test_array_with_present_key_should_return_true()
{
$validator = new Key('bar');
$obj = array();
$obj['bar'] = 'foo';
$this->assertTrue($validator->assert($obj));
$this->assertTrue($validator->check($obj));
$this->assertTrue($validator->validate($obj));
}
示例3: testShouldHaveTheSameReturnValueForAllValidators
public function testShouldHaveTheSameReturnValueForAllValidators()
{
$rule = new Key('key', new NotEmpty());
$input = array('key' => '');
try {
$rule->assert($input);
$this->fail('`assert()` must throws exception');
} catch (\Exception $e) {
}
try {
$rule->check($input);
$this->fail('`check()` must throws exception');
} catch (\Exception $e) {
}
$this->assertFalse($rule->validate($input));
}