public function testBrokenXmlDefinition()
 {
     $this->setExpectedException(DOMException::CLASS);
     $state_machine_definition_file = dirname(__FILE__) . '/Fixture/broken_state_machine.xml';
     $parser = new StateMachineDefinitionParser();
     $parser->parse($state_machine_definition_file);
 }
 /**
  * Adds only valid workflow names to the available choices.
  */
 protected function setupProperties()
 {
     parent::setupProperties();
     $input = $this->getData('input');
     $parser = new StateMachineDefinitionParser();
     $workflows = $parser->parse($input);
     $this->choices = array_keys($workflows);
 }
 protected function buildStateMachineDefinitions()
 {
     $state_machine_definitions = [];
     $parser = new StateMachineDefinitionParser();
     $xml_files = (include AgaviConfig::get('core.config_dir') . '/includes/workflow_configs.php');
     foreach ($xml_files as $file) {
         $state_machine_definitions = array_merge($state_machine_definitions, $parser->parse($file));
     }
     return $state_machine_definitions;
 }
Пример #4
0
 /**
  * Parses the configured state machine definition file and returns all parsed state machine definitions.
  *
  * @return array An assoc array with name of a state machine as key and the state machine def as value.
  */
 protected function parseStateMachineDefitions()
 {
     $defs = $this->getOption('state_machine_definition');
     if ($defs instanceof ImmutableOptionsInterface) {
         return $defs->toArray();
     } elseif (is_array($defs)) {
         return $defs;
     }
     if (!is_string($defs)) {
         throw new RuntimeError('Option "state_machine_definition" must be a path to an xml file ' . 'or already parsed definitions provided as an array.');
     }
     $parser = new StateMachineDefinitionParser();
     return $parser->parse($defs);
 }
 protected function buildStateMachineDefinitions()
 {
     $state_machine_definitions = [];
     $parser = new StateMachineDefinitionParser();
     $xml_files = (include AgaviConfig::get('core.testing_dir') . '/config/workflow_configs.php');
     foreach ($xml_files as $file) {
         $state_machine_definitions = array_merge($state_machine_definitions, $parser->parse($file));
     }
     // put the author workflow on the other test types – this doesn't make much sense, but it
     // saves us from duplicating the xml workflow definitions for tests
     $example_workflow = $state_machine_definitions['honeybee_cmf.test_fixtures.author.default_workflow'];
     $state_machine_definitions['honeybee_cmf.test_fixtures.book.default_workflow'] = $example_workflow;
     $state_machine_definitions['honeybee_cmf.test_fixtures.publication.default_workflow'] = $example_workflow;
     $state_machine_definitions['honeybee_cmf.test_fixtures.publisher.default_workflow'] = $example_workflow;
     return $state_machine_definitions;
 }
Пример #6
0
 /**
  * Parses the configured state machine definition file and returns all parsed state machine definitions.
  *
  * @return array An assoc array with name of a state machine as key and the state machine def as value.
  */
 protected function parseStateMachineDefitions()
 {
     $state_machine_definition_file = $this->getOption('state_machine_definition');
     $parser = new StateMachineDefinitionParser();
     return $parser->parse($state_machine_definition_file);
 }