public function testLoad()
 {
     $container = new ContainerBuilder();
     // fake entity manager and security context services
     $container->set('doctrine.orm.entity_manager', $this->getSqliteEntityManager());
     $container->set('security.authorization_checker', $this->getMockAuthorizationChecker());
     $container->set('event_dispatcher', new EventDispatcher());
     $container->set('next_state_condition', new \stdClass());
     // simple config
     $extension = new WorkflowExtension();
     $extension->load(array($this->getSimpleConfig()), $container);
     $this->assertTrue($container->getDefinition('lexik_workflow.process.document_proccess') instanceof Definition);
     // config with a process
     $extension = new WorkflowExtension();
     $extension->load(array($this->getConfig()), $container);
     $this->assertTrue($container->getDefinition('lexik_workflow.process.document_proccess') instanceof Definition);
     $this->assertTrue($container->getDefinition('lexik_workflow.process.document_proccess.step.step_create_doc') instanceof Definition);
     $this->assertTrue($container->getDefinition('lexik_workflow.process.document_proccess.step.step_validate_doc') instanceof Definition);
     $this->assertTrue($container->getDefinition('lexik_workflow.process.document_proccess.step.step_remove_doc') instanceof Definition);
     $this->assertTrue($container->getDefinition('lexik_workflow.handler.document_proccess') instanceof Definition);
     $processHandlerFactory = $container->get('lexik_workflow.process_aggregator');
     $this->assertTrue($processHandlerFactory instanceof ProcessAggregator);
     $this->assertTrue($processHandlerFactory->getProcess('document_proccess') instanceof Process);
     $processHandler = $container->get('lexik_workflow.handler.document_proccess');
     $this->assertTrue($processHandler instanceof ProcessHandler);
 }
Example #2
0
 public function testProcessService()
 {
     $container = new ContainerBuilder();
     $container->set('next_state_condition', new \stdClass());
     $extension = new WorkflowExtension();
     $extension->load(array($this->getConfig()), $container);
     $process = $container->get('lexik_workflow.process.document_proccess');
     $this->assertTrue($process instanceof Process);
     $this->assertTrue($process->getSteps() instanceof ArrayCollection);
     $this->assertEquals(3, $process->getSteps()->count());
     $this->assertTrue($process->getSteps()->get('step_create_doc') instanceof Step);
 }