/** * cover \Magento\Theme\Model\Config::assignToStore */ public function testAssignToStoreNonSingleStoreMode() { $this->_storeManagerMock->expects($this->once())->method('isSingleStoreMode')->will($this->returnValue(false)); $themePath = 'Magento/blank'; /** Unassign themes from store */ $configEntity = new \Magento\Framework\DataObject(['value' => 6, 'scope_id' => 8]); $this->_configData->expects($this->once())->method('getCollection')->will($this->returnValue($this->_configData)); $this->_configData->expects($this->at(1))->method('addFieldToFilter')->with('scope', \Magento\Store\Model\ScopeInterface::SCOPE_STORES)->will($this->returnValue($this->_configData)); $this->_configData->expects($this->at(2))->method('addFieldToFilter')->with('path', \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID)->will($this->returnValue([$configEntity])); $this->_themeMock->expects($this->any())->method('getId')->will($this->returnValue(6)); $this->_themeMock->expects($this->any())->method('getThemePath')->will($this->returnValue($themePath)); $this->_scopeConfigWriter->expects($this->once())->method('delete'); $this->_scopeConfigWriter->expects($this->exactly(3))->method('save'); $this->_model->assignToStore($this->_themeMock, [2, 3, 5]); }
/** * @test */ public function process() { $finderMock = $this->getMock('Semaio\\ConfigImportExport\\Model\\File\\Finder', ['find']); $finderMock->expects($this->once())->method('find')->willReturn(['abc.yaml']); $parseResult = ['test/config/custom_field_one' => ['default' => [0 => 'ABC']]]; $readerMock = $this->getMock('Semaio\\ConfigImportExport\\Model\\File\\Reader\\YamlReader', ['parse']); $readerMock->expects($this->once())->method('parse')->willReturn($parseResult); $this->scopeValidatorMock->expects($this->once())->method('validate')->willReturn(true); $this->configWriterMock->expects($this->once())->method('save'); $processor = new ImportProcessor($this->configWriterMock, $this->scopeValidatorMock, $this->scopeConverterMock); $processor->setOutput($this->outputMock); $processor->setFinder($finderMock); $processor->setReader($readerMock); $processor->process(); }