本文整理汇总了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);
}