public function testCollection() { $collection = $this->_model->getCollection()->joinStore()->addDateFilter(); /** * @todo fix and add addStoreFilter method */ $this->assertEmpty($collection->getItems()); }
/** * @test * @return void * @covers \Magento\Theme\Model\Design::changeDesign * @covers \Magento\Theme\Model\Design::__construct * @covers \Magento\Theme\Model\Design::_construct */ public function testChangeDesign() { $design = $this->getMockBuilder('Magento\\Framework\\View\\DesignInterface')->getMock(); $this->model->setDesign('test'); /** @var $design \Magento\Framework\View\DesignInterface */ $this->assertInstanceOf(get_class($this->model), $this->model->changeDesign($design)); }
public function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); // Mocks $this->designMock = $this->getMockBuilder('Magento\\Theme\\Model\\Design')->disableOriginalConstructor()->setMethods([])->getMock(); $this->storeManagerMock = $this->getMockBuilder('Magento\\Store\\Model\\StoreManagerInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->translateMock = $this->getMockBuilder('Magento\\Framework\\TranslateInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config\\ScopeConfigInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->localeResolverMock = $this->getMockBuilder('Magento\\Framework\\Locale\\ResolverInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->inlineConfigMock = $this->getMockBuilder('Magento\\Framework\\Translate\\Inline\\ConfigInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->inlineTranslationMock = $this->getMockBuilder('Magento\\Framework\\Translate\\Inline\\StateInterface')->disableOriginalConstructor()->setMethods([])->getMock(); $this->viewDesignMock = $this->getMockForAbstractClass('Magento\\Framework\\View\\DesignInterface'); $this->storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->setMethods(['__wakeup', 'getStoreId'])->getMock(); // Stubs $this->designMock->expects($this->any())->method('loadChange')->willReturnSelf(); $this->designMock->expects($this->any())->method('getData')->willReturn(false); // Prepare SUT $this->model = $this->objectManager->getObject('Magento\\Store\\Model\\App\\Emulation', ['storeManager' => $this->storeManagerMock, 'viewDesign' => $this->viewDesignMock, 'design' => $this->designMock, 'translate' => $this->translateMock, 'scopeConfig' => $this->scopeConfigMock, 'inlineConfig' => $this->inlineConfigMock, 'inlineTranslation' => $this->inlineTranslationMock, 'localeResolver' => $this->localeResolverMock]); }