public function entryAction(Context $context) { $command = $this->getCommand($this->getEntryCommandName(), $context); $this->execute($command); $this->callCallable($this->getEntryCallable(), $context, self::CALLABLE_ENTRY); }
/** * @test */ public function shouldFailEntryAndExitWithNonCallable() { $state = new State('a'); $context = new Context(new Identifier('123', 'foo-machine')); $event = 'foo'; $callable = "Foo::BarEntry"; $state->setEntryCallable($callable); $callable = "Foo::BarExit"; $state->setExitCallable($callable); try { $state->entryAction($context); $this->fail('should not come here'); } catch (Exception $e) { $this->assertEquals(Exception::CALLABLE_FAILURE, $e->getCode()); } try { $state->exitAction($context); $this->fail('should not come here'); } catch (Exception $e) { $this->assertEquals(Exception::CALLABLE_FAILURE, $e->getCode()); } }