Пример #1
0
 /**
  * @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();
     /** @var Attribute $attribute */
     foreach ($attributes ? $attributes : array() as $attribute) {
         $expectedAttributes[$attribute->getName()] = $attribute;
     }
     $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()));
 }
 /**
  * @expectedException \Oro\Bundle\WorkflowBundle\Exception\InvalidParameterException
  * @expectedExceptionMessage Option "label" at view attribute "0" of step "step_one" is required
  */
 public function testViewAttributeRequiredLabelException()
 {
     $this->formOptionsAssembler->expects($this->once())->method('assemble')->will($this->returnValue(array()));
     $configuration = array('step_one' => array('label' => 'label', 'view_attributes' => array(array('path' => '$path'))));
     $attributes = array($this->createAttribute('attribute_one'));
     $this->assembler->assemble($configuration, $attributes);
 }
Пример #3
0
 /**
  * @param array $configuration
  * @param Collection $attributes
  * @return Step[]|Collection
  */
 protected function assembleSteps(array $configuration, Collection $attributes)
 {
     $stepsConfiguration = $this->getOption($configuration, WorkflowConfiguration::NODE_STEPS, array());
     return $this->stepAssembler->assemble($stepsConfiguration, $attributes);
 }