示例#1
0
 /**
  * To create the raw  data components
  *
  * @param string $component
  * @return array
  */
 public function createRawComponentData($component)
 {
     $componentData = $this->componentConfigProvider->getComponentData($component);
     $componentData[Converter::DATA_ATTRIBUTES_KEY] = isset($componentData[Converter::DATA_ATTRIBUTES_KEY]) ? $componentData[Converter::DATA_ATTRIBUTES_KEY] : [];
     $componentData[Converter::DATA_ARGUMENTS_KEY] = isset($componentData[Converter::DATA_ARGUMENTS_KEY]) ? $componentData[Converter::DATA_ARGUMENTS_KEY] : [];
     return [ManagerInterface::COMPONENT_ATTRIBUTES_KEY => $componentData[Converter::DATA_ATTRIBUTES_KEY], ManagerInterface::COMPONENT_ARGUMENTS_KEY => $componentData[Converter::DATA_ARGUMENTS_KEY]];
 }
示例#2
0
 /**
  * @dataProvider getComponentDataProvider()
  */
 public function testCreateRawComponentData($componentName, $configData, $componentData, $needEvaluate)
 {
     $this->componentConfigProvider->expects($this->any())->method('getComponentData')->willReturn($configData);
     if ($needEvaluate === true) {
         $this->argumentInterpreter->expects($this->once())->method('evaluate')->willReturnCallback(function ($argument) {
             return ['argument' => $argument['value']];
         });
     } else {
         $this->argumentInterpreter->expects($this->never())->method('evaluate');
     }
     $this->assertEquals($componentData, $this->manager->createRawComponentData($componentName, $needEvaluate));
 }
示例#3
0
 /**
  * To create the raw  data components
  *
  * @param string $component
  * @param bool $evaluated
  * @return array
  */
 public function createRawComponentData($component, $evaluated = true)
 {
     $componentData = $this->componentConfigProvider->getComponentData($component);
     $componentData[Converter::DATA_ATTRIBUTES_KEY] = isset($componentData[Converter::DATA_ATTRIBUTES_KEY]) ? $componentData[Converter::DATA_ATTRIBUTES_KEY] : [];
     $componentData[Converter::DATA_ARGUMENTS_KEY] = isset($componentData[Converter::DATA_ARGUMENTS_KEY]) ? $componentData[Converter::DATA_ARGUMENTS_KEY] : [];
     if ($evaluated) {
         foreach ($componentData[Converter::DATA_ARGUMENTS_KEY] as $argumentName => $argument) {
             $componentData[Converter::DATA_ARGUMENTS_KEY][$argumentName] = $this->argumentInterpreter->evaluate($argument);
         }
     }
     return [ManagerInterface::COMPONENT_ATTRIBUTES_KEY => $componentData[Converter::DATA_ATTRIBUTES_KEY], ManagerInterface::COMPONENT_ARGUMENTS_KEY => $componentData[Converter::DATA_ARGUMENTS_KEY]];
 }