public function testMergeCompleteAndPartial() { $fileList = [file_get_contents(__DIR__ . '/_files/catalog_new_products_list.xml'), file_get_contents(__DIR__ . '/_files/orders_and_returns_customized.xml')]; $this->fileResolver->expects($this->once())->method('get')->with('widget.xml', 'global')->willReturn($fileList); $expected = (include __DIR__ . '/_files/expectedMergedArray.php'); $this->assertEquals($expected, $this->model->read('global')); }
public function testReadFile() { $file = file_get_contents(__DIR__ . '/_files/code/Magento/Test/etc/widget.xml'); $result = $this->_model->readFile($file); $expected = (include '_files/expectedGlobalArray.php'); $this->assertEquals($expected, $result); }
public function testGetWidgetConfigAsArray() { $widget = ['@' => ['type' => 'Magento\\Cms\\Block\\Widget\\Page\\Link', 'module' => 'Magento_Cms'], 'name' => 'CMS Page Link', 'description' => 'Link to a CMS Page', 'is_email_compatible' => 'true', 'placeholder_image' => 'Magento_Cms::images/widget_page_link.png', 'parameters' => ['page_id' => ['@' => ['type' => 'complex'], 'type' => 'label', 'helper_block' => ['type' => 'Magento\\Cms\\Block\\Adminhtml\\Page\\Widget\\Chooser', 'data' => ['button' => ['open' => 'Select Page...']]], 'visible' => 'true', 'required' => 'true', 'sort_order' => '10', 'label' => 'CMS Page']]]; $this->_widgetModelMock->expects($this->once())->method('getWidgetByClassType')->will($this->returnValue($widget)); $xmlFile = __DIR__ . '/../_files/widget.xml'; $this->_viewFileSystemMock->expects($this->once())->method('getFilename')->will($this->returnValue($xmlFile)); $themeConfigFile = __DIR__ . '/../_files/mappedConfigArrayAll.php'; $themeConfig = (include $themeConfigFile); $this->_readerMock->expects($this->once())->method('readFile')->with($this->equalTo($xmlFile))->will($this->returnValue($themeConfig)); $result = $this->_model->getWidgetConfigAsArray(); $expectedConfigFile = __DIR__ . '/../_files/mappedConfigArray1.php'; $expectedConfig = (include $expectedConfigFile); $this->assertEquals($expectedConfig, $result); }