public function testUpdateDataNoUpdates() { $this->moduleManager->expects($this->once())->method('isDbSchemaUpToDate')->with('Test_Module', 'catalog_setup')->will($this->returnValue(true)); $this->moduleManager->expects($this->once())->method('isDbDataUpToDate')->with('Test_Module', 'catalog_setup')->will($this->returnValue(true)); $this->_factoryMock->expects($this->never())->method('create'); $this->_appStateMock->expects($this->at(0))->method('setUpdateMode')->with(true); $this->_appStateMock->expects($this->at(1))->method('setUpdateMode')->with(false); $this->_factoryMock->expects($this->never())->method('create'); $this->_model->updateScheme(); $this->_model->updateData(); }
public function testUpdateDataAppliesDataUpdatesIfSchemaIsUpdated() { $this->_appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(false)); $this->_appStateMock->expects($this->at(1))->method('setUpdateMode')->with(true); $this->_appStateMock->expects($this->at(2))->method('setUpdateMode')->with(false); $this->_resourceSetupMock->expects($this->once())->method('applyUpdates'); $this->_resourceSetupMock->expects($this->once())->method('getCallAfterApplyAllUpdates')->will($this->returnValue(true)); $this->_resourceSetupMock->expects($this->once())->method('afterApplyAllUpdates'); $this->_resourceSetupMock->expects($this->once())->method('applyDataUpdates'); $this->_model->updateScheme(); $this->_model->updateData(); }
/** * Database installation * * @return $this */ public function installDb() { $this->_dbUpdater->updateScheme(); $data = $this->getDataModel()->getConfigData(); /** * Saving host information into DB */ if (!empty($data['use_rewrites'])) { $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_USE_REWRITES, 1); } if (!empty($data['enable_charts'])) { $this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 1); } else { $this->_installSetup->setConfigData(\Magento\Backend\Block\Dashboard::XML_PATH_ENABLE_CHARTS, 0); } if (!empty($data['admin_no_form_key'])) { $this->_installSetup->setConfigData('admin/security/use_form_key', 0); } $unsecureBaseUrl = $this->_storeManager->getStore()->getBaseUrl('web'); if (!empty($data['unsecure_base_url'])) { $unsecureBaseUrl = $data['unsecure_base_url']; $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_UNSECURE_BASE_URL, $unsecureBaseUrl); } if (!empty($data['use_secure'])) { $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_FRONTEND, 1); $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $data['secure_base_url']); if (!empty($data['use_secure_admin'])) { $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_IN_ADMINHTML, 1); } } elseif (!empty($data['unsecure_base_url'])) { $this->_installSetup->setConfigData(\Magento\Store\Model\Store::XML_PATH_SECURE_BASE_URL, $unsecureBaseUrl); } /** * Saving locale information into DB */ $locale = $this->getDataModel()->getLocaleData(); if (!empty($locale['locale'])) { $this->_installSetup->setConfigData($this->_localeResolver->getDefaultLocalePath(), $locale['locale']); } if (!empty($locale['timezone'])) { $this->_installSetup->setConfigData($this->_localeDate->getDefaultTimezonePath(), $locale['timezone']); } if (!empty($locale['currency'])) { $this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, $locale['currency']); $this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_DEFAULT, $locale['currency']); $this->_installSetup->setConfigData(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_ALLOW, $locale['currency']); } if (!empty($data['order_increment_prefix'])) { $this->_setOrderIncrementPrefix($this->_installSetup, $data['order_increment_prefix']); } return $this; }