/** * @expectedException \Exception * @expectedExceptionMessage Reset workflow exception message */ public function testResetWorkflowItemException() { $workflowItem = $this->createWorkflowItem(); $entity = new WorkflowAwareEntity(); $workflowItem->setEntity($entity); $aclManager = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Acl\\AclManager')->disableOriginalConstructor()->getMock(); $workflow = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\Workflow')->setConstructorArgs(array(new EntityConnector(), $aclManager, null, null, null))->setMethods(null)->getMock(); $entityManager = $this->createEntityManager(); $entityManager->expects($this->once())->method('beginTransaction'); $entityManager->expects($this->once())->method('remove')->will($this->throwException(new \Exception('Reset workflow exception message'))); $entityManager->expects($this->once())->method('rollback'); $this->registry->expects($this->once())->method('getManagerForClass')->will($this->returnValue($entityManager)); $this->workflowRegistry->expects($this->any())->method('getWorkflow')->with(self::TEST_WORKFLOW_NAME)->will($this->returnValue($workflow)); $this->workflowManager->resetWorkflowItem($workflowItem); }