Esempio n. 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()));
 }