示例#1
0
 public function testGetConfigAsObjectWidgetNoFound()
 {
     $this->dataStorageMock->expects($this->once())->method('get')->willReturn([]);
     $resultObject = $this->widget->getConfigAsObject('Magento\\Cms\\Block\\Widget\\Page\\Link');
     $this->assertInstanceOf('Magento\\Framework\\DataObject', $resultObject);
     $this->assertSame([], $resultObject->getData());
 }
示例#2
0
 /**
  * Add fields to main fieldset based on specified widget type
  *
  * @throws \Magento\Framework\Model\Exception
  * @return $this
  */
 public function addFields()
 {
     // get configuration node and translation helper
     if (!$this->getWidgetType()) {
         throw new \Magento\Framework\Model\Exception(__('Please specify a Widget Type.'));
     }
     $config = $this->_widget->getConfigAsObject($this->getWidgetType());
     if (!$config->getParameters()) {
         return $this;
     }
     foreach ($config->getParameters() as $parameter) {
         $this->_addField($parameter);
     }
     return $this;
 }