コード例 #1
0
 /**
  * Execute workflow start for scheduled entities.
  */
 public function postFlush()
 {
     $currentDeepLevel = $this->deepLevel;
     if (!empty($this->entitiesScheduledForWorkflowStart[$currentDeepLevel])) {
         $this->deepLevel++;
         $massStartData = $this->entitiesScheduledForWorkflowStart[$currentDeepLevel];
         unset($this->entitiesScheduledForWorkflowStart[$currentDeepLevel]);
         $this->workflowManager->massStartWorkflow($massStartData);
         $this->deepLevel--;
     }
 }
コード例 #2
0
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage Mass start workflow exception message
  */
 public function testMassStartWorkflowException()
 {
     $entityManager = $this->createEntityManager();
     $entityManager->expects($this->once())->method('beginTransaction');
     $entityManager->expects($this->once())->method('rollback');
     $entityManager->expects($this->never())->method('persist');
     $this->registry->expects($this->once())->method('getManager')->will($this->returnValue($entityManager));
     $workflowName = 'test_workflow';
     $entity = new \DateTime();
     $workflow = $this->createWorkflow($workflowName);
     $workflow->expects($this->once())->method('start')->with($entity, array(), null)->will($this->throwException(new \Exception('Mass start workflow exception message')));
     $this->workflowRegistry->expects($this->once())->method('getWorkflow')->with($workflowName)->will($this->returnValue($workflow));
     $this->workflowManager->massStartWorkflow(array(array('workflow' => $workflowName, 'entity' => $entity)));
 }