protected function setUp() { $this->_themeFactory = $this->getMock('Magento\\Theme\\Model\\ThemeFactory', ['create'], [], '', false); $this->_theme = $this->getMock('Magento\\Theme\\Model\\Theme', ['load', 'getId', 'getType', 'getDomainModel', 'isVirtual', '__wakeup'], [], '', false); $this->_themeFactory->expects($this->any())->method('create')->will($this->returnValue($this->_theme)); $this->_copyService = $this->getMock('Magento\\Theme\\Model\\CopyService', ['copy'], [], '', false); $this->_model = new \Magento\DesignEditor\Model\Theme\Context($this->_themeFactory, $this->_copyService); }
/** * @test * @return void * @covers \Magento\Theme\Model\View\Design::getDesignParams * @covers \Magento\Theme\Model\View\Design::getLocale * @covers \Magento\Theme\Model\View\Design::getArea * @covers \Magento\Theme\Model\View\Design::getDesignTheme */ public function testGetDesignParams() { $locale = 'locale'; $area = Design::DEFAULT_AREA; $localeMock = $this->getMockForAbstractClass('\\Magento\\Framework\\Locale\\ResolverInterface'); $localeMock->expects($this->once())->method('getLocale')->will($this->returnValue($locale)); $this->objectManager->expects($this->once())->method('get')->will($this->returnValue($localeMock)); $this->state->expects($this->any())->method('getAreaCode')->willReturn($area); $this->themeFactory->expects($this->once())->method('create')->willReturn($this->getMockBuilder('Magento\\Framework\\View\\Design\\ThemeInterface')->getMock()); $params = $this->model->getDesignParams(); $this->assertInstanceOf('Magento\\Framework\\View\\Design\\ThemeInterface', $params['themeModel']); $this->assertEquals($area, $params['area']); $this->assertEquals($locale, $params['locale']); }