function testGetStateHistoryAllCommandsInHistory()
  {
    $factory = new MockCommandsFactory($this);
    $state_machine = new StateMachineCommand($factory);

    $state_machine->registerState('Initial', array('foo' => 'NextState'));
    $state_machine->registerState('NextState', array('bar' => 'ExtraState'));
    $state_machine->registerState('ExtraState');

    $factory->expectOnce('performInitial');
    $factory->setReturnValue('performInitial', 'foo');
    $factory->expectOnce('performNextState');
    $factory->setReturnValue('performNextState', 'bar');
    $factory->expectOnce('performExtraState');
    $factory->setReturnValue('performExtraState', 'some_result');

    $this->assertEqual($state_machine->perform(), 'some_result');

    $this->assertEqual($state_machine->getStateHistory(),
                       array(array('Initial' => 'foo'),
                             array('NextState' => 'bar'),
                             array('ExtraState' => 'some_result')));

    $this->assertEqual($state_machine->getEndState(), array('ExtraState' => 'some_result'));

    $factory->tally();
  }