/** * Build transition form. * * @param Form $form The form being built. * * @return void */ private function buildForm(Form $form) { $this->form = $form; $this->getTransition()->buildForm($this->form, $this->item); $form->prepare($this->item, $this->context); $this->listener->onBuildForm($form, $this->workflow, $this->item, $this->context, $this->getTransition()->getName()); }
function it_transits_to_next_state(Form $form, Transition $transition, Item $item, Listener $listener, State $state) { $listener->onBuildForm(Argument::cetera())->shouldBeCalled(); $listener->onValidate(Argument::cetera())->willReturn(true); $listener->onPreTransit(Argument::cetera())->shouldBeCalled(); $listener->onPostTransit(Argument::cetera())->shouldBeCalled(); $item->transit($transition, Argument::type(static::CONTEXT_CLASS), Argument::type(static::ERROR_COLLECTION_CLASS), true)->shouldBeCalled()->willReturn($state); $transition->executeActions($item, Argument::type(static::CONTEXT_CLASS), Argument::type(static::ERROR_COLLECTION_CLASS))->willReturn(true)->shouldBeCalled(); $transition->executePostActions($item, Argument::type(static::CONTEXT_CLASS), Argument::type(static::ERROR_COLLECTION_CLASS))->willReturn(true)->shouldBeCalled(); $transition->buildForm($form, $item)->shouldBeCalled(); $transition->checkPreCondition($item, Argument::type(static::CONTEXT_CLASS), Argument::type(static::ERROR_COLLECTION_CLASS))->shouldBeCalled(); $this->validate($form); $this->transit()->shouldHaveType('Netzmacht\\Workflow\\Flow\\State'); }