Пример #1
0
 public function testSetSteps()
 {
     $stepOne = new WorkflowStep();
     $stepOne->setName('step1');
     $this->workflowDefinition->addStep($stepOne);
     $stepTwo = new WorkflowStep();
     $stepTwo->setName('step2');
     $this->workflowDefinition->addStep($stepTwo);
     $stepThree = new WorkflowStep();
     $stepThree->setName('step3');
     $this->workflowDefinition->addStep($stepThree);
     $this->assertCount(3, $this->workflowDefinition->getSteps());
     $this->assertTrue($this->workflowDefinition->hasStepByName('step3'));
     $this->workflowDefinition->removeStep($stepThree);
     $this->assertFalse($this->workflowDefinition->hasStepByName('step3'));
     $this->assertCount(2, $this->workflowDefinition->getSteps());
     $this->workflowDefinition->setSteps(new ArrayCollection(array($stepOne)));
     $actualSteps = $this->workflowDefinition->getSteps();
     $this->assertCount(1, $actualSteps);
     $this->assertEquals($stepOne, $actualSteps[0]);
 }