protected function setUp()
 {
     $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->factoryMock = $this->getMock('\\Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false);
     $this->collectionFactoryMock = $this->getMock('\\Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', [], [], '', false);
     $this->escaperMock = $this->getMock('\\Magento\\Framework\\Escaper', [], [], '', false);
     $this->configMock = $this->getMock('\\Magento\\Framework\\DataObject', ['getData'], [], '', false);
     $this->model = $this->objectManager->getObject('Magento\\Framework\\Data\\Form\\Element\\Editor', ['factoryElement' => $this->factoryMock, 'factoryCollection' => $this->collectionFactoryMock, 'escaper' => $this->escaperMock, 'data' => ['config' => $this->configMock]]);
     $this->formMock = $this->getMock('Magento\\Framework\\Data\\Form', ['getHtmlIdPrefix', 'getHtmlIdSuffix'], [], '', false, false);
     $this->model->setForm($this->formMock);
 }
Exemple #2
0
 /**
  * Wysiwyg constructor.
  * @param ContextInterface $context
  * @param Form $form
  * @param EditorElement $editorElement
  * @param ConfigInterface $wysiwygConfig
  * @param array $components
  * @param array $data
  */
 public function __construct(ContextInterface $context, Form $form, EditorElement $editorElement, ConfigInterface $wysiwygConfig, array $components = [], array $data = [])
 {
     $this->editorElement = $editorElement;
     $this->editorElement->setForm($form);
     $this->editorElement->setData('force_load', true);
     $this->editorElement->setData('rows', 20);
     $this->editorElement->setData('name', $data['name']);
     $this->editorElement->setData('html_id', $data['name'] . 'Editor');
     $this->editorElement->setConfig($wysiwygConfig->getConfig());
     $data['config']['content'] = $editorElement->getElementHtml();
     parent::__construct($context, $components, $data);
 }