repositoryMock = $this->createMock(\Magento\Framework\View\Asset\Repository::class); $this->viewConfigFactoryMock = $this->createMock(\Magento\Framework\Config\ViewFactory::class); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->config = $this->objectManagerHelper->getObject( \Magento\Framework\View\Config::class, [ 'assetRepo' => $this->repositoryMock, 'viewConfigFactory' => $this->viewConfigFactoryMock ] ); } public function testGetViewConfig() { $themeCode = 'area/theme'; $themeMock = $this->createPartialMock(\Magento\Theme\Model\Theme::class, ['getFullPath']); $themeMock->expects($this->atLeastOnce()) ->method('getFullPath') ->will($this->returnValue($themeCode)); $params = [ 'themeModel' => $themeMock, 'area' => 'frontend' ]; $this->repositoryMock->expects($this->atLeastOnce()) ->method('updateDesignParams') ->with($this->equalTo($params)) ->will($this->returnSelf()); $configViewMock = $this->createMock(\Magento\Framework\Config\View::class); $this->viewConfigFactoryMock->expects($this->once()) ->method('create') ->willReturn($configViewMock); $this->assertInstanceOf(\Magento\Framework\Config\View::class, $this->config->getViewConfig($params)); // lazy load test $this->assertInstanceOf(\Magento\Framework\Config\View::class, $this->config->getViewConfig($params)); } }