diff --git a/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php b/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php index 8bc0a9a1271e4..2ab2b63e5ff62 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php +++ b/app/code/Magento/Config/Model/Config/Backend/Currency/Base.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Backend Directory currency backend model * Allows dispatching before and after events for each controller action @@ -14,6 +12,33 @@ class Base extends AbstractCurrency { + /** @var \Magento\Directory\Model\CurrencyFactory */ + private $currencyFactory; + + /** + * @param \Magento\Framework\Model\Context $context + * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\App\Config\ScopeConfigInterface $config + * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory + * @param \Magento\Framework\Model\Resource\AbstractResource $resource + * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection + * @param array $data + */ + public function __construct( + \Magento\Framework\Model\Context $context, + \Magento\Framework\Registry $registry, + \Magento\Framework\App\Config\ScopeConfigInterface $config, + \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, + \Magento\Directory\Model\CurrencyFactory $currencyFactory, + \Magento\Framework\Model\Resource\AbstractResource $resource = null, + \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + array $data = [] + ) { + parent::__construct($context, $registry, $config, $scopeConfig, $resource, $resourceCollection, $data); + $this->currencyFactory = $currencyFactory; + } + /** * Check base currency is available in installed currencies * @@ -22,9 +47,14 @@ class Base extends AbstractCurrency */ public function afterSave() { - if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Framework\Exception\LocalizedException(__('Sorry, we haven\'t installed the base currency you selected.')); + $value = $this->getValue(); + if (!in_array($value, $this->_getInstalledCurrencies())) { + throw new \Magento\Framework\Exception\LocalizedException( + __('Sorry, we haven\'t installed the base currency you selected.') + ); } + + $this->currencyFactory->create()->saveRates([$value =>[$value => 1]]); return $this; } } diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php index 8321bbcefac24..0a6125fd5fbf9 100644 --- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php +++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php @@ -42,6 +42,7 @@ public function __construct() $objectManager = Bootstrap::getObjectManager(); $this->_soapConfig = $objectManager->get('Magento\Webapi\Model\Soap\Config'); $this->_converter = $objectManager->get('Magento\Framework\Api\SimpleDataObjectConverter'); + ini_set('default_socket_timeout', 120); } /** diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index 21db76cc7545b..85246e5521462 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -1801,9 +1801,6 @@ public function insertOnDuplicate($table, array $data, array $fields = []) $fields = $cols; } - // quote column names - // $cols = array_map(array($this, 'quoteIdentifier'), $cols); - // prepare ON DUPLICATE KEY conditions foreach ($fields as $k => $v) { $field = $value = null;