public function testImport() { $step = new WorkflowStep(); $step->setName('step'); $definition = new WorkflowDefinition(); $definition->addStep($step); $this->entityAcl->setAttribute('attribute'); $this->entityAcl->setStep($step); $this->entityAcl->setEntityClass('TestEntity'); $this->entityAcl->setUpdatable(false); $this->entityAcl->setDeletable(false); $newEntityAcl = new WorkflowEntityAcl(); $newEntityAcl->setDefinition($definition); $this->assertEquals($newEntityAcl, $newEntityAcl->import($this->entityAcl)); $this->assertEquals('attribute', $newEntityAcl->getAttribute()); $this->assertEquals($step, $newEntityAcl->getStep()); $this->assertEquals('TestEntity', $newEntityAcl->getEntityClass()); $this->assertFalse($this->entityAcl->isUpdatable()); $this->assertFalse($this->entityAcl->isDeletable()); $this->assertEquals($this->entityAcl->getAttributeStepKey(), $newEntityAcl->getAttributeStepKey()); }
/** * @param WorkflowEntityAcl $acl * @return WorkflowEntityAcl */ public function import(WorkflowEntityAcl $acl) { $this->setAttribute($acl->getAttribute())->setStep($this->getDefinition()->getStepByName($acl->getStep()->getName()))->setEntityClass($acl->getEntityClass())->setUpdatable($acl->isUpdatable())->setDeletable($acl->isDeletable()); return $this; }