the Command will be configured with the 'reference' of the stateful
object
public static getCommand ( string $command_name, |
||
$command_name | string | entry~,exit~ or transition command name. multiple commands can be split by a ',' in which case a composite command will be returned. |
$context | to be able to get the entity | |
return | izzum\command\ICommand |
/** * @test */ public function shouldGetExceptionForNonExistingCommand() { $command_name = 'bogus'; $context = new Context(new Identifier('1', 'test')); try { $command = Utils::getCommand($command_name, $context); $this->fail('should not come here, command does not exist'); } catch (Exception $e) { $this->assertEquals(Exception::COMMAND_CREATION_FAILURE, $e->getCode()); $this->assertContains('class does not exist', $e->getMessage()); //echo $e->getMessage() . PHP_EOL; } }
/** * returns the associated Command for the entry/exit action. * the Command will be configured with the domain model via dependency injection * * @param string $command_name * entry or exit command name * @param Context $context * @return ICommand * @throws Exception */ protected function getCommand($command_name, Context $context) { return Utils::getCommand($command_name, $context); }
/** * returns the associated Command for this Transition. * the Command will be configured with the 'reference' of the stateful * object. * In case there have been multiple commands as input (',' seperated), this * method will return a Composite command. * * @param Context $context * @return izzum\command\ICommand * @throws Exception */ public function getCommand(Context $context) { return Utils::getCommand($this->command, $context); }