本文整理匯總了PHP中Symfony\Component\Validator\ExecutionContext::expects方法的典型用法代碼示例。如果您正苦於以下問題:PHP ExecutionContext::expects方法的具體用法?PHP ExecutionContext::expects怎麽用?PHP ExecutionContext::expects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\Validator\ExecutionContext
的用法示例。
在下文中一共展示了ExecutionContext::expects方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testNotExistingFormData
public function testNotExistingFormData()
{
$formConfig = $this->getMock('\\Symfony\\Component\\Form\\FormConfigInterface');
$form = new Form($formConfig);
$this->context = $this->getMock('\\Symfony\\Component\\Validator\\ExecutionContextInterface');
$this->context->expects($this->any())->method('getRoot')->will($this->returnValue($form));
$this->validator->initialize($this->context);
$this->assertNull($this->validator->validate(false, $this->constraint));
}
示例2: testInvalidValues
/**
* @dataProvider getInvalidValues
*/
public function testInvalidValues($value)
{
$this->context->expects($this->once())->method('addViolation');
$constraint = new User();
$this->validator->validate($value, $constraint);
}
示例3: testInvalidData
public function testInvalidData()
{
$this->formField->expects($this->any())->method('getData')->will($this->returnValue($this->dateTimeStart));
$this->context->expects($this->once())->method('addViolation')->with($this->equalTo($this->constraint->message), $this->equalTo(array('{{ ' . $this->constraint->getDefaultOption() . ' }}' => $this->constraint->field)));
$this->validator->validate($this->dateTimeEnd, $this->constraint);
}