public setEntryCallable ( callable $callable ) | ||
$callable | callable |
public function setEntryCallable($callable)
{
$this->callable_entry = $callable;
return $this;
}
/** * @test */ public function shouldEnterWithCallable() { $state = new State('a'); $context = new Context(new Identifier('123', 'foo-machine')); $event = 'foo'; $callable = function ($entity) { $entity->setEntityId('234'); }; $state->setEntryCallable($callable); $this->assertEquals('123', $context->getEntityId()); $state->exitAction($context); $this->assertEquals('123', $context->getEntityId()); $state->entryAction($context); $this->assertEquals('234', $context->getEntityId()); }