izzum\statemachine\State::getEntryCommandName PHP Method

getEntryCommandName() public method

get the fully qualified command name for entry of the state
public getEntryCommandName ( ) : string
return string
    public function getEntryCommandName()
    {
        return $this->command_entry_name;
    }

Usage Example

 /**
  * @test
  */
 public function shoulFailInvalidAction()
 {
     // scenario 1
     $context = new Context(new Identifier('1', 'test'));
     $command_name = 'izzum\\command\\bogus';
     $state = new State('a', State::TYPE_INITIAL, $command_name);
     $this->assertEquals($command_name, $state->getEntryCommandName());
     $this->assertEquals('', $state->getExitCommandName());
     try {
         $state->entryAction($context);
         $this->fail('should not come here');
     } catch (\Exception $e) {
         $this->assertEquals(Exception::COMMAND_CREATION_FAILURE, $e->getCode());
     }
     // null command
     $state->exitAction($context);
     // scenario 2
     $context = new Context(new Identifier('1', 'test'));
     $command_name = 'izzum\\command\\bogus';
     $state = new State('a', State::TYPE_INITIAL, State::COMMAND_EMPTY, $command_name);
     $this->assertEquals($command_name, $state->getExitCommandName());
     $this->assertEquals('', $state->getEntryCommandName());
     // null command
     $state->entryAction($context);
     try {
         $state->exitAction($context);
         $this->fail('should not come here');
     } catch (\Exception $e) {
         $this->assertEquals(Exception::COMMAND_CREATION_FAILURE, $e->getCode());
     }
 }