/**
  * @dataProvider configurationDataProvider
  */
 public function testAssemble($configuration, $attributes, Step $expectedStep)
 {
     $configurationPass = $this->getMockBuilder('Oro\\Bundle\\WorkflowBundle\\Model\\ConfigurationPass\\ConfigurationPassInterface')->getMockForAbstractClass();
     $configurationPass->expects($this->any())->method('passConfiguration')->with($this->isType('array'))->will($this->returnCallback(function (array $data) {
         if (isset($data['path'])) {
             $data['path'] = new PropertyPath('data.' . str_replace('$', '', $data['path']));
         } else {
             foreach ($data as &$value) {
                 $value = new PropertyPath('data.' . str_replace('$', '', $value));
             }
         }
         return $data;
     }));
     $this->assembler->addConfigurationPass($configurationPass);
     $expectedAttributes = array();
     foreach ($attributes ? $attributes : array() as $attribute) {
         $expectedAttributes[$attribute->getName()] = $attribute;
     }
     $this->formOptionsAssembler->expects($this->once())->method('assemble')->with($this->isType('array'), $expectedAttributes, 'step', $expectedStep->getName())->will($this->returnArgument(0));
     $steps = $this->assembler->assemble($configuration, $attributes);
     $this->assertInstanceOf('Doctrine\\Common\\Collections\\ArrayCollection', $steps);
     $this->assertCount(1, $steps);
     $this->assertTrue($steps->containsKey($expectedStep->getName()));
     $this->assertEquals($expectedStep, $steps->get($expectedStep->getName()));
 }
 public function testGetAllowedTransitions()
 {
     $firstTransition = new Transition();
     $firstTransition->setName('first_transition');
     $secondTransition = new Transition();
     $secondTransition->setName('second_transition');
     $step = new Step();
     $step->setName('test_step');
     $step->setAllowedTransitions(array($secondTransition->getName()));
     $workflow = $this->createWorkflow();
     $workflow->getStepManager()->setSteps(array($step));
     $workflow->getTransitionManager()->setTransitions(array($firstTransition, $secondTransition));
     $workflowItem = new WorkflowItem();
     $workflowItem->setCurrentStepName($step->getName());
     $actualTransitions = $workflow->getTransitionsByWorkflowItem($workflowItem);
     $this->assertEquals(array($secondTransition), $actualTransitions->getValues());
 }