/** * @param string $entityClass * @return null|Workflow */ public function getApplicableWorkflowByEntityClass($entityClass) { return $this->workflowRegistry->getActiveWorkflowByEntityClass($entityClass); }
public function testGetActiveWorkflowByEntityClassNoWorkflow() { $entityClass = '\\stdClass'; $workflowName = 'test_workflow'; $workflowDefinition = new WorkflowDefinition(); $workflowDefinition->setName($workflowName); $workflowDefinitionRepository = $this->createWorkflowDefinitionRepositoryMock(); $workflowDefinitionRepository->expects($this->once())->method('find')->with($workflowName)->will($this->returnValue(null)); $managerRegistry = $this->createManagerRegistryMock($workflowDefinitionRepository); $workflowAssembler = $this->createWorkflowAssemblerMock(); $configProvider = $this->createConfigurationProviderMock(); $configProvider->expects($this->any())->method('hasConfig')->with($entityClass)->will($this->returnValue(true)); $config = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface')->getMock(); $config->expects($this->any())->method('get')->with('active_workflow')->will($this->returnValue($workflowName)); $configProvider->expects($this->any())->method('getConfig')->with($entityClass)->will($this->returnValue($config)); $workflowRegistry = new WorkflowRegistry($managerRegistry, $workflowAssembler, $configProvider); $this->assertNull($workflowRegistry->getActiveWorkflowByEntityClass($entityClass)); }