public function testPrePersist() { $eventArgs = $this->prophesize('Doctrine\\ORM\\Event\\LifecycleEventArgs'); $eventArgs->getEntity()->willReturn('entity'); $this->validator->validate('entity')->shouldBeCalled(); $this->subscriber->prePersist($eventArgs->reveal()); }
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()); }
/** @test */ public function use_number_validator() { $ocr = $this->ocr(); $ocr->read($this->validInput()); $this->numberValidatorProphecy->validate($this->builtNumber)->shouldHaveBeenCalled(); }