/** * @dataProvider workflowNameDataProvider * @param string|null $requiredWorkflowName */ public function testGetWorkflowItemsByEntity($requiredWorkflowName) { $entity = new \DateTime('now'); $entityClass = get_class($entity); $entityId = 1; $this->doctrineHelper->expects($this->any())->method('getEntityIdentifier')->with($entity)->will($this->returnValue($entityId)); $workflowItems = array($this->createWorkflowItem()); $workflowItemsRepository = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Entity\\Repository\\WorkflowItemRepository')->disableOriginalConstructor()->setMethods(array('findByEntityMetadata'))->getMock(); $workflowItemsRepository->expects($this->any())->method('findByEntityMetadata')->with($entityClass, $entityId, $requiredWorkflowName)->will($this->returnValue($workflowItems)); $this->registry->expects($this->any())->method('getRepository')->with('OroWorkflowBundle:WorkflowItem')->will($this->returnValue($workflowItemsRepository)); $this->assertEquals($workflowItems, $this->workflowManager->getWorkflowItemsByEntity($entity, $requiredWorkflowName)); }