/**
  * Verifies the builder's current state and builds a state machine off of it.
  *
  * @return Workflux\StateMachine\StateMachineInterface
  */
 public function build()
 {
     $state_machine_definition = $this->resolveStateMachineDefinition();
     $this->setStateMachineName($state_machine_definition['name']);
     if (isset($state_machine_definition['class'])) {
         $this->setStateMachineClass($state_machine_definition['class']);
     }
     foreach ($state_machine_definition['states'] as $state_name => $state_definition) {
         $this->addState($this->createState($state_definition));
         $this->addEventTransitions($state_definition);
         $this->addSequentialTransitions($state_definition);
     }
     return parent::build();
 }
 public function testMissingStateMachineClass()
 {
     $this->setExpectedException(VerificationError::CLASS, 'Unable to load state machine class "HeisenStateMachine".');
     $states = [new State('editing', StateInterface::TYPE_INITIAL), new State('published', StateInterface::TYPE_FINAL)];
     $transiton = new Transition('editing', 'published');
     $builder = new StateMachineBuilder();
     $state_machine = $builder->setStateMachineName(self::MACHINE_NAME)->setStateMachineClass('HeisenStateMachine')->addStates($states)->addTransition($transiton, 'promote')->build();
 }