本文整理汇总了PHP中Prophecy\Prophecy\ObjectProphecy::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectProphecy::validate方法的具体用法?PHP ObjectProphecy::validate怎么用?PHP ObjectProphecy::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Prophecy\Prophecy\ObjectProphecy
的用法示例。
在下文中一共展示了ObjectProphecy::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testPrePersist
public function testPrePersist()
{
$eventArgs = $this->prophesize('Doctrine\\ORM\\Event\\LifecycleEventArgs');
$eventArgs->getEntity()->willReturn('entity');
$this->validator->validate('entity')->shouldBeCalled();
$this->subscriber->prePersist($eventArgs->reveal());
}
示例2: testValidateShouldApplyRequirementForEachElementIfParamIsArray
public function testValidateShouldApplyRequirementForEachElementIfParamIsArray()
{
$param = $this->prophesize(Param::class);
$param->requirements = '\\d+';
$param->array = true;
$that = $this;
$this->validator->validate(Argument::type('array'), Argument::type('array'))->shouldBeCalledTimes(1)->will(function ($args) use($that) {
$constraints = $args[1];
$that->assertNotEmpty($constraints);
$constraint = $constraints[0];
$that->assertInstanceOf(All::class, $constraint);
});
$this->paramValidator->validate(['foo', '15'], $param->reveal());
}
示例3: use_number_validator
/** @test */
public function use_number_validator()
{
$ocr = $this->ocr();
$ocr->read($this->validInput());
$this->numberValidatorProphecy->validate($this->builtNumber)->shouldHaveBeenCalled();
}