public function testIsAllManagedEntitiesSpecified() { $managedAttributeName = 'entity'; $managedAttribute = new Attribute(); $managedAttribute->setName($managedAttributeName); $workflow = $this->createWorkflow(self::TEST_WORKFLOW_NAME, array($managedAttribute)); $this->workflowRegistry->expects($this->any())->method('getWorkflow')->with(self::TEST_WORKFLOW_NAME)->will($this->returnValue($workflow)); $validWorkflowItem = $this->createWorkflowItem(); $validWorkflowItem->getData()->set($managedAttributeName, new \DateTime()); $this->assertTrue($this->workflowManager->isAllManagedEntitiesSpecified($validWorkflowItem)); $invalidWorkflowItem = $this->createWorkflowItem(); $this->assertFalse($this->workflowManager->isAllManagedEntitiesSpecified($invalidWorkflowItem)); }
/** * @param WorkflowItem $workflowItem * @throws NotFoundHttpException */ public function validate(WorkflowItem $workflowItem) { if (!$this->workflowManager->isAllManagedEntitiesSpecified($workflowItem)) { throw new NotFoundHttpException('Managed entities for workflow item not found'); } }