예제 #1
0
 /**
  * Test verify that theme contains available containers for widget
  */
 public function testAvailableContainers()
 {
     $themeToTest = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('\\Magento\\Theme\\Model\\Theme');
     $themeId = $themeToTest->load('Magento/blank', 'code')->getId();
     $this->block->setTheme($themeId);
     $this->assertContains('<option value="before.body.end" >', $this->block->toHtml());
 }
예제 #2
0
 public function testSetGetAllowedContainers()
 {
     $this->assertEmpty($this->_block->getAllowedContainers());
     $containers = array('some_container', 'another_container');
     $this->_block->setAllowedContainers($containers);
     $this->assertEquals($containers, $this->_block->getAllowedContainers());
 }
예제 #3
0
 /**
  * @return void
  */
 public function testToHtmlOrderBySkuAllPages()
 {
     $pageLayoutProcessorContainers = ['after.body.start' => 'Page Top', 'columns.top' => 'Before Main Columns', 'main' => 'Main Content Container', 'page.bottom' => 'Before Page Footer Container', 'before.body.end' => 'Page Bottom', 'header.container' => 'Page Header Container', 'page.top' => 'After Page Header', 'footer-container' => 'Page Footer Container', 'sidebar.main' => 'Sidebar Main', 'sidebar.additional' => 'Sidebar Additional'];
     $layoutProcessorContainers = ['header.panel' => 'Page Header Panel', 'header-wrapper' => 'Page Header', 'top.container' => 'After Page Header Top', 'content.top' => 'Main Content Top', 'content' => 'Main Content Area', 'content.aside' => 'Main Content Aside', 'content.bottom' => 'Main Content Bottom', 'page.bottom' => 'Before Page Footer', 'footer' => 'Page Footer', 'cms_footer_links_container' => 'CMS Footer Links'];
     $allowedContainers = ['sidebar.main', 'sidebar.additional'];
     $expectedHtml = '<select name="block" id="" class="required-entry select" title="" ' . 'onchange="WidgetInstance.loadSelectBoxByType(\'block_template\', this.up(\'div.group_container\'), ' . 'this.value)"><option value="" selected="selected" >-- Please Select --</option>' . '<option value="sidebar.additional" >Sidebar Additional</option><option value="sidebar.main" >' . 'Sidebar Main</option></select>';
     $this->eventManagerMock->expects($this->once())->method('dispatch')->willReturn(true);
     $this->scopeConfigMock->expects($this->once())->method('getValue')->willReturn(false);
     $this->themeCollectionFactoryMock->expects($this->once())->method('create')->willReturn($this->themeCollectionMock);
     $this->themeCollectionMock->expects($this->once())->method('getItemById')->willReturn($this->themeMock);
     $this->layoutProcessorFactoryMock->expects($this->exactly(2))->method('create')->willReturn($this->layoutMergeMock);
     $this->layoutMergeMock->expects($this->exactly(2))->method('addPageHandles')->willReturn(true);
     $this->layoutMergeMock->expects($this->exactly(2))->method('load')->willReturnSelf();
     $this->layoutMergeMock->expects($this->any())->method('addHandle')->willReturnSelf();
     $this->layoutMergeMock->expects($this->any())->method('getContainers')->willReturnOnConsecutiveCalls($pageLayoutProcessorContainers, $layoutProcessorContainers);
     $this->containerBlock->setAllowedContainers($allowedContainers);
     $this->containerBlock->setValue('');
     $this->escaperMock->expects($this->any())->method('escapeHtml')->willReturnMap([['', null, ''], ['-- Please Select --', null, '-- Please Select --'], ['sidebar.additional', null, 'sidebar.additional'], ['Sidebar Additional', null, 'Sidebar Additional'], ['sidebar.main', null, 'sidebar.main'], ['Sidebar Main', null, 'Sidebar Main']]);
     $this->assertEquals($expectedHtml, $this->containerBlock->toHtml());
 }
예제 #4
0
 /**
  * Test verify that theme contains available containers for widget
  */
 public function testAvailableContainers()
 {
     $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\DesignInterface');
     $this->block->setTheme($design->getDesignTheme()->getId());
     $this->assertContains('<option value="before.body.end" >', $this->block->toHtml());
 }