diff --git a/.gitignore b/.gitignore index 12af626be05db..9269cefc51fa0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ atlassian* /nbproject /sitemap +/sitemap.xml /.idea /.gitattributes /app/config_sandbox diff --git a/app/code/Magento/AdminNotification/etc/adminhtml/system.xml b/app/code/Magento/AdminNotification/etc/adminhtml/system.xml index 8e4fbab1b18c0..8038b914fd65b 100644 --- a/app/code/Magento/AdminNotification/etc/adminhtml/system.xml +++ b/app/code/Magento/AdminNotification/etc/adminhtml/system.xml @@ -10,11 +10,11 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\AdminNotification\Model\Config\Source\Frequency diff --git a/app/code/Magento/Authorization/etc/di.xml b/app/code/Magento/Authorization/etc/di.xml index a686527b9df5b..1159fb0a7606e 100644 --- a/app/code/Magento/Authorization/etc/di.xml +++ b/app/code/Magento/Authorization/etc/di.xml @@ -24,4 +24,5 @@ Magento\Framework\Acl\Builder\Proxy + diff --git a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml index bf1092dcf4e30..fd2fb84f0a290 100644 --- a/app/code/Magento/Authorizenet/etc/adminhtml/system.xml +++ b/app/code/Magento/Authorizenet/etc/adminhtml/system.xml @@ -10,15 +10,15 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Authorizenet\Model\Source\PaymentAction - + @@ -33,29 +33,29 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Sales\Model\Config\Source\Order\Status\Processing - + Magento\Config\Model\Config\Source\Yesno - + - + - + Magento\Config\Model\Config\Source\Locale\Currency - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -63,7 +63,7 @@ validate-email - + Magento\Authorizenet\Model\Source\Cctype @@ -71,7 +71,7 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Payment\Model\Config\Source\Allspecificcountries diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index 8c885a5a65be5..7297f3a6c2299 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -32,12 +32,12 @@ Magento_Backend::trans_email - + validate-email Magento\Config\Model\Config\Backend\Email\Address - + Magento\Config\Model\Config\Backend\Email\Sender validate-emailSender @@ -45,12 +45,12 @@ - + validate-email Magento\Config\Model\Config\Backend\Email\Address - + Magento\Config\Model\Config\Backend\Email\Sender validate-emailSender @@ -58,12 +58,12 @@ - + validate-email Magento\Config\Model\Config\Backend\Email\Address - + Magento\Config\Model\Config\Backend\Email\Sender validate-emailSender @@ -71,12 +71,12 @@ - + validate-email Magento\Config\Model\Config\Backend\Email\Address - + Magento\Config\Model\Config\Backend\Email\Sender validate-emailSender @@ -84,12 +84,12 @@ - + validate-email Magento\Config\Model\Config\Backend\Email\Address - + Magento\Config\Model\Config\Backend\Email\Sender validate-emailSender @@ -127,7 +127,7 @@ Magento\Config\Model\Config\Source\Yesno Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk. - + Magento\Config\Model\Config\Source\Yesno Minification is not applied in developer mode. @@ -177,7 +177,7 @@ - + Magento\Config\Model\Config\Source\Image\Adapter Magento\Config\Model\Config\Backend\Image\Adapter @@ -198,16 +198,16 @@ Magento_Config::config_general - + Magento\Directory\Model\Config\Source\Country 1 - + Magento\Directory\Model\Config\Source\Country - + Magento\Directory\Model\Config\Source\Country @@ -227,11 +227,11 @@ Magento\Config\Model\Config\Source\Locale - + Magento\Config\Model\Config\Source\Locale\Weekdays - + Magento\Config\Model\Config\Source\Locale\Weekdays 1 @@ -290,15 +290,15 @@ Magento_Config::config_system - + Magento\Config\Model\Config\Source\Yesno - + For Windows server only. - + For Windows server only. @@ -322,31 +322,31 @@ Magento_Config::config_admin - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Email\Identity - + Magento\Config\Model\Config\Source\Admin\Page - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Admin\Usecustom - + Magento\Config\Model\Config\Backend\Admin\Custom @@ -354,12 +354,12 @@ Make sure that base URL ends with '/' (slash), e.g. http://yourdomain/magento/ - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Admin\Custompath - + required-entry validate-alphanum Magento\Config\Model\Config\Backend\Admin\Custompath @@ -371,13 +371,13 @@ - + Please enter a number 1 or greater in this field. required-entry integer validate-greater-than-zero Magento\Config\Model\Config\Backend\Admin\Password\Link\Expirationperiod - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Admin\Usesecretkey @@ -386,7 +386,7 @@ Magento\Config\Model\Config\Source\Yesno - + Please enter at least 60 and at most 31536000 (one year). Magento\Backend\Model\Config\SessionLifetime\BackendModel @@ -395,7 +395,7 @@ - + Magento\Config\Model\Config\Source\Yesno @@ -407,7 +407,7 @@ Magento_Backend::web - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Store @@ -415,7 +415,7 @@ Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]> - + Magento\Config\Model\Config\Source\Web\Redirect I.e. redirect from http://example.com/store/ to http://www.example.com/store/ @@ -423,7 +423,7 @@ - + Magento\Config\Model\Config\Source\Yesno @@ -436,7 +436,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{unsecure_base_url}} placeholder. @@ -460,7 +460,7 @@ Magento\Config\Model\Config\Backend\Baseurl Specify URL or {{base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Backend\Baseurl May start with {{secure_base_url}} or {{unsecure_base_url}} placeholder. @@ -475,13 +475,13 @@ Magento\Config\Model\Config\Backend\Baseurl May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure Enter https protocol to use Secure URLs on Storefront. - + Magento\Config\Model\Config\Source\Yesno Magento\Config\Model\Config\Backend\Secure @@ -507,38 +507,38 @@ 1 - + - + - + - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Allows customers to stay logged in when switching between different stores. Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Bundle/Model/Option/Validator.php b/app/code/Magento/Bundle/Model/Option/Validator.php index 1c1b409cb1474..7ff56d3958b4d 100644 --- a/app/code/Magento/Bundle/Model/Option/Validator.php +++ b/app/code/Magento/Bundle/Model/Option/Validator.php @@ -5,7 +5,6 @@ */ namespace Magento\Bundle\Model\Option; -use Magento\Framework\Exception\InputException; use Magento\Framework\Validator\NotEmpty; use Magento\Framework\Validator\NotEmptyFactory; use Zend_Validate_Exception; @@ -52,7 +51,7 @@ protected function validateRequiredFields($value) ]; foreach ($requiredFields as $requiredField => $requiredValue) { if (!$this->notEmpty->isValid(trim($requiredValue))) { - $messages[$requiredField] = __(InputException::REQUIRED_FIELD, ['fieldName' => $requiredField]); + $messages[$requiredField] = __('%fieldName is a required field.', ['fieldName' => $requiredField]); } } $this->_addMessages($messages); diff --git a/app/code/Magento/Captcha/etc/adminhtml/system.xml b/app/code/Magento/Captcha/etc/adminhtml/system.xml index fb0670a9f69ea..dc4c737597cce 100644 --- a/app/code/Magento/Captcha/etc/adminhtml/system.xml +++ b/app/code/Magento/Captcha/etc/adminhtml/system.xml @@ -10,32 +10,32 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Captcha\Model\Config\Font 1 - + Magento\Captcha\Model\Config\Form\Backend 1 - + Magento\Captcha\Model\Config\Mode 1 - + If 0 is specified, CAPTCHA on the Login form will be always available. @@ -44,14 +44,14 @@ required-entry validate-digits - + 1 required-entry validate-digits - + Please specify 8 symbols at the most. Range allowed (e.g. 3-5) @@ -59,7 +59,7 @@ required-entry - + Similar looking characters (e.g. "i", "l", "1") decrease chance of correct recognition by customer.]]> @@ -69,7 +69,7 @@ required-entry validate-alphanum - + Magento\Config\Model\Config\Source\Yesno @@ -81,18 +81,18 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Captcha\Model\Config\Font 1 - + Magento\Captcha\Model\Config\Form\Frontend CAPTCHA for "Create user" and "Forgot password" forms is always enabled if chosen. @@ -100,14 +100,14 @@ 1 - + Magento\Captcha\Model\Config\Mode 1 - + If 0 is specified, CAPTCHA on the Login form will be always available. @@ -116,14 +116,14 @@ required-entry validate-digits - + 1 required-entry validate-digits - + Please specify 8 symbols at the most. Range allowed (e.g. 3-5) @@ -131,7 +131,7 @@ required-entry validate-range range-1-8 - + Similar looking characters (e.g. "i", "l", "1") decrease chance of correct recognition by customer.]]> @@ -141,7 +141,7 @@ required-entry validate-alphanum - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Catalog/etc/adminhtml/system.xml b/app/code/Magento/Catalog/etc/adminhtml/system.xml index 1759f365582cb..85949a953fc53 100644 --- a/app/code/Magento/Catalog/etc/adminhtml/system.xml +++ b/app/code/Magento/Catalog/etc/adminhtml/system.xml @@ -17,50 +17,50 @@ Magento_Catalog::config_catalog - + Use {{name}} as Product Name placeholder - + Use {{name}} as Product Name placeholder - + Use {{name}} as Product Name or {{sku}} as Product SKU placeholders - + Use {{name}} and {{description}} as Product Name and Product Description placeholders - + Magento\Catalog\Model\Config\Source\ListMode - + Comma-separated. validate-per-page-value-list - + Must be in the allowed values list validate-per-page-value - + Comma-separated. validate-per-page-value-list - + Must be in the allowed values list validate-per-page-value - + Magento\Catalog\Model\Indexer\Category\Flat\System\Config\Mode Magento\Config\Model\Config\Source\Yesno @@ -70,7 +70,7 @@ Magento\Catalog\Model\Indexer\Product\Flat\System\Config\Mode Magento\Config\Model\Config\Source\Yesno - + Magento\Catalog\Model\Config\Source\ListSort @@ -79,7 +79,7 @@ Whether to show "All" option in the "Show X Per Page" dropdown Magento\Config\Model\Config\Source\Yesno - + E.g. {{media url="path/to/image.jpg"}} {{skin url="path/to/picture.gif"}}. Dynamic directives parsing impacts catalog performance. Magento\Config\Model\Config\Source\Yesno @@ -98,14 +98,14 @@ - + - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -122,7 +122,7 @@ - + @@ -132,11 +132,11 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Catalog\Block\Adminhtml\Form\Renderer\Config\DateFieldsOrder - + Magento\Catalog\Model\Config\Source\TimeFormat diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 92f86792a83fa..b5af80144c856 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -600,6 +600,18 @@ + + + + Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE + + + + Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface + + + + diff --git a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml index 0bfc90a84e0ac..e32d794a9e0b2 100644 --- a/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogInventory/etc/adminhtml/system.xml @@ -13,25 +13,25 @@ Magento_CatalogInventory::cataloginventory - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Products will still be shown by direct product URLs. Magento\Config\Model\Config\Source\Yesno Magento\CatalogInventory\Model\Config\Backend\ShowOutOfStock - + validate-number - + Magento\Config\Model\Config\Source\Yesno @@ -41,33 +41,33 @@ - + Magento\Config\Model\Config\Source\Yesno Magento\CatalogInventory\Model\Config\Backend\Managestock Changing can take some time due to processing whole catalog. - + Magento\CatalogInventory\Model\Source\Backorders Magento\CatalogInventory\Model\Config\Backend\Backorders Changing can take some time due to processing whole catalog. - + validate-number - + validate-number Magento\CatalogInventory\Model\System\Config\Backend\Minqty - + Magento\CatalogInventory\Block\Adminhtml\Form\Field\Minsaleqty Magento\CatalogInventory\Model\System\Config\Backend\Minsaleqty - + validate-number @@ -75,11 +75,11 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + validate-number validate-greater-than-zero Magento\CatalogInventory\Model\System\Config\Backend\Qtyincrements diff --git a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml index 19ff3c464c3bd..2402e81ba49ed 100644 --- a/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogSearch/etc/adminhtml/system.xml @@ -9,21 +9,21 @@
- + Magento\Config\Model\Config\Source\Enabledisable - + Magento\CatalogSearch\Model\Adminhtml\System\Config\Backend\Engine - + validate-digits - + validate-digits diff --git a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml index 9c80b38a49886..d8cf69dd8502a 100644 --- a/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml +++ b/app/code/Magento/CatalogUrlRewrite/etc/adminhtml/system.xml @@ -10,21 +10,21 @@
- + Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix You need to refresh the cache. - + Magento\Catalog\Model\System\Config\Backend\Catalog\Url\Rewrite\Suffix You need to refresh the cache. - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Checkout/etc/adminhtml/system.xml b/app/code/Magento/Checkout/etc/adminhtml/system.xml index f52ffdaa0319c..d4567a4382539 100644 --- a/app/code/Magento/Checkout/etc/adminhtml/system.xml +++ b/app/code/Magento/Checkout/etc/adminhtml/system.xml @@ -13,53 +13,53 @@ Magento_Checkout::checkout - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + - + Magento\Config\Model\Config\Source\Yesno - + Magento\Checkout\Model\Config\Source\Cart\Summary - + Magento\Config\Model\Config\Source\Yesno - + - + Magento\Config\Model\Config\Source\Email\Identity - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template diff --git a/app/code/Magento/Cms/etc/adminhtml/system.xml b/app/code/Magento/Cms/etc/adminhtml/system.xml index d998f6a664356..ee0c3d4ebfd09 100644 --- a/app/code/Magento/Cms/etc/adminhtml/system.xml +++ b/app/code/Magento/Cms/etc/adminhtml/system.xml @@ -9,34 +9,34 @@
- + Magento\Cms\Model\Config\Source\Page - + Magento\Cms\Model\Config\Source\Page - + Magento\Cms\Model\Config\Source\Page - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -48,7 +48,7 @@ Magento_Cms::config_cms - + Magento\Cms\Model\Config\Source\Wysiwyg\Enabled diff --git a/app/code/Magento/Config/Block/System/Config/Form.php b/app/code/Magento/Config/Block/System/Config/Form.php index 0204219765dd3..939b02dcec618 100644 --- a/app/code/Magento/Config/Block/System/Config/Form.php +++ b/app/code/Magento/Config/Block/System/Config/Form.php @@ -361,7 +361,8 @@ protected function _initElement( 'scope_id' => $this->getScopeId(), 'scope_label' => $this->getScopeLabel($field), 'can_use_default_value' => $this->canUseDefaultValue($field->showInDefault()), - 'can_use_website_value' => $this->canUseWebsiteValue($field->showInWebsite()) + 'can_use_website_value' => $this->canUseWebsiteValue($field->showInWebsite()), + 'can_restore_to_default' => $this->isCanRestoreToDefault($field->canRestore()) ] ); $field->populateInput($formField); @@ -502,6 +503,20 @@ public function canUseWebsiteValue($fieldValue) return false; } + /** + * Check if can use restore value + * + * @param int $fieldValue + * @return bool + */ + public function isCanRestoreToDefault($fieldValue) + { + if ($this->getScope() == self::SCOPE_DEFAULT && $fieldValue) { + return true; + } + return false; + } + /** * Retrieve current scope * diff --git a/app/code/Magento/Config/Block/System/Config/Form/Field.php b/app/code/Magento/Config/Block/System/Config/Form/Field.php index 3a50627f28784..0af9706b93728 100644 --- a/app/code/Magento/Config/Block/System/Config/Form/Field.php +++ b/app/code/Magento/Config/Block/System/Config/Form/Field.php @@ -123,7 +123,9 @@ protected function _renderInheritCheckbox(\Magento\Framework\Data\Form\Element\A */ protected function _isInheritCheckboxRequired(\Magento\Framework\Data\Form\Element\AbstractElement $element) { - return $element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue(); + return $element->getCanUseWebsiteValue() + || $element->getCanUseDefaultValue() + || $element->getCanRestoreToDefault(); } /** @@ -134,7 +136,10 @@ protected function _isInheritCheckboxRequired(\Magento\Framework\Data\Form\Eleme */ protected function _getInheritCheckboxLabel(\Magento\Framework\Data\Form\Element\AbstractElement $element) { - $checkboxLabel = __('Use Default'); + $checkboxLabel = __('Use system value'); + if ($element->getCanUseDefaultValue()) { + $checkboxLabel = __('Use Default'); + } if ($element->getCanUseWebsiteValue()) { $checkboxLabel = __('Use Website'); } diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php index 7cc431eae0689..dce05bb66614a 100644 --- a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php +++ b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php @@ -282,6 +282,16 @@ public function showInStore() return isset($this->_data['showInStore']) && (int)$this->_data['showInStore']; } + /** + * Check if the field can be restored to default + * + * @return bool + */ + public function canRestore() + { + return isset($this->_data['canRestore']) && (int)$this->_data['canRestore']; + } + /** * Populate form element with field data * diff --git a/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php b/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php index b8b6b253eb39a..985c816a06b33 100644 --- a/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php +++ b/app/code/Magento/Config/Test/Unit/Block/System/Config/FormTest.php @@ -549,6 +549,7 @@ public function testInitFields( 'scope_label' => '[GLOBAL]', 'can_use_default_value' => false, 'can_use_website_value' => false, + 'can_restore_to_default' => false, ]; $formFieldMock->expects($this->once())->method('setRenderer')->with($fieldRendererMock); diff --git a/app/code/Magento/Config/etc/system.xsd b/app/code/Magento/Config/etc/system.xsd index a7078defccd71..b0b62101d35c1 100644 --- a/app/code/Magento/Config/etc/system.xsd +++ b/app/code/Magento/Config/etc/system.xsd @@ -60,6 +60,7 @@ + diff --git a/app/code/Magento/Config/etc/system_file.xsd b/app/code/Magento/Config/etc/system_file.xsd index d4b42ca09ac32..fc90d36ebaae6 100644 --- a/app/code/Magento/Config/etc/system_file.xsd +++ b/app/code/Magento/Config/etc/system_file.xsd @@ -61,6 +61,7 @@ + diff --git a/app/code/Magento/Config/i18n/en_US.csv b/app/code/Magento/Config/i18n/en_US.csv index 0bbeabde93603..5f89220eb476c 100644 --- a/app/code/Magento/Config/i18n/en_US.csv +++ b/app/code/Magento/Config/i18n/en_US.csv @@ -102,3 +102,4 @@ Dashboard,Dashboard "Web Section","Web Section" "Store Email Addresses Section","Store Email Addresses Section" "Email to a Friend","Email to a Friend" +"Use system value","Use system value" diff --git a/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml b/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml index 7a8e56f6d1f0e..c7e4090948fad 100644 --- a/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml +++ b/app/code/Magento/ConfigurableProduct/etc/adminhtml/system.xml @@ -9,7 +9,7 @@
- + Magento\Catalog\Model\Config\Source\Product\Thumbnail diff --git a/app/code/Magento/Contact/etc/adminhtml/system.xml b/app/code/Magento/Contact/etc/adminhtml/system.xml index 7110fd22de889..ca1ced83457d4 100644 --- a/app/code/Magento/Contact/etc/adminhtml/system.xml +++ b/app/code/Magento/Contact/etc/adminhtml/system.xml @@ -13,7 +13,7 @@ Magento_Contact::contact - + Magento\Config\Model\Config\Source\Yesno Magento\Contact\Model\System\Config\Backend\Links @@ -21,15 +21,15 @@ - + validate-email - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template diff --git a/app/code/Magento/Cookie/etc/adminhtml/system.xml b/app/code/Magento/Cookie/etc/adminhtml/system.xml index 1d1dc127948d3..646683f7e3f6c 100644 --- a/app/code/Magento/Cookie/etc/adminhtml/system.xml +++ b/app/code/Magento/Cookie/etc/adminhtml/system.xml @@ -10,7 +10,7 @@
- + Magento\Cookie\Model\Config\Backend\Lifetime @@ -29,7 +29,7 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno Magento\Cookie\Model\Config\Backend\Cookie diff --git a/app/code/Magento/Cron/etc/adminhtml/system.xml b/app/code/Magento/Cron/etc/adminhtml/system.xml index d4366b43a666e..9596ae3a7e39c 100644 --- a/app/code/Magento/Cron/etc/adminhtml/system.xml +++ b/app/code/Magento/Cron/etc/adminhtml/system.xml @@ -13,25 +13,25 @@ For correct URLs generated during cron runs please make sure that Web > Secure and Unsecure Base URLs are explicitly set. All the times are in minutes. - + - + - + - + - + - + - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Customer/Model/AccountManagement.php b/app/code/Magento/Customer/Model/AccountManagement.php index af24467cfaf32..16a644341e034 100644 --- a/app/code/Magento/Customer/Model/AccountManagement.php +++ b/app/code/Magento/Customer/Model/AccountManagement.php @@ -516,7 +516,7 @@ public function initiatePasswordReset($email, $template, $websiteId = null) default: throw new InputException( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['value' => $template, 'fieldName' => 'email type'] ) ); @@ -923,12 +923,14 @@ public function isCustomerInStore($customerWebsiteId, $storeId) private function validateResetPasswordToken($customerId, $resetPasswordLinkToken) { if (empty($customerId) || $customerId < 0) { - $params = ['value' => $customerId, 'fieldName' => 'customerId']; - throw new InputException(__(InputException::INVALID_FIELD_VALUE, $params)); + throw new InputException(__( + 'Invalid value of "%value" provided for the %fieldName field.', + ['value' => $customerId, 'fieldName' => 'customerId'] + )); } if (!is_string($resetPasswordLinkToken) || empty($resetPasswordLinkToken)) { $params = ['fieldName' => 'resetPasswordLinkToken']; - throw new InputException(__(InputException::REQUIRED_FIELD, $params)); + throw new InputException(__('%fieldName is a required field.', $params)); } $customerSecureData = $this->customerRegistry->retrieveSecureData($customerId); @@ -1179,7 +1181,7 @@ public function changeResetPasswordLinkToken($customer, $passwordLinkToken) if (!is_string($passwordLinkToken) || empty($passwordLinkToken)) { throw new InputException( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['value' => $passwordLinkToken, 'fieldName' => 'password reset token'] ) ); diff --git a/app/code/Magento/Customer/Model/CustomerRegistry.php b/app/code/Magento/Customer/Model/CustomerRegistry.php index b9ad13a02546b..66bb90b18b11f 100644 --- a/app/code/Magento/Customer/Model/CustomerRegistry.php +++ b/app/code/Magento/Customer/Model/CustomerRegistry.php @@ -120,12 +120,12 @@ public function retrieveByEmail($customerEmail, $websiteId = null) // customer does not exist throw new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ - 'fieldName' => 'email', + 'fieldName' => 'email', 'fieldValue' => $customerEmail, 'field2Name' => 'websiteId', - 'field2Value' => $websiteId, + 'field2Value' => $websiteId ] ) ); diff --git a/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php b/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php index dafe03454131e..eb281e33c86df 100644 --- a/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php +++ b/app/code/Magento/Customer/Model/Metadata/AddressMetadata.php @@ -79,12 +79,12 @@ public function getAttributeMetadata($attributeCode) } else { throw new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'entityType', 'fieldValue' => AddressMetadataInterface::ENTITY_TYPE_ADDRESS, 'field2Name' => 'attributeCode', - 'field2Value' => $attributeCode, + 'field2Value' => $attributeCode ] ) ); diff --git a/app/code/Magento/Customer/Model/Metadata/AttributeResolver.php b/app/code/Magento/Customer/Model/Metadata/AttributeResolver.php index fb752db83b789..79b8fe78661b5 100644 --- a/app/code/Magento/Customer/Model/Metadata/AttributeResolver.php +++ b/app/code/Magento/Customer/Model/Metadata/AttributeResolver.php @@ -46,12 +46,12 @@ public function getModelByAttribute($entityType, AttributeMetadataInterface $att } else { throw new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'entityType', 'fieldValue' => $entityType, 'field2Name' => 'attributeCode', - 'field2Value' => $attribute->getAttributeCode(), + 'field2Value' => $attribute->getAttributeCode() ] ) ); diff --git a/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php b/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php index 26ca809a5945e..736f9f2a29ba8 100644 --- a/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php +++ b/app/code/Magento/Customer/Model/Metadata/CustomerMetadata.php @@ -79,12 +79,12 @@ public function getAttributeMetadata($attributeCode) } else { throw new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'entityType', 'fieldValue' => self::ENTITY_TYPE_CUSTOMER, 'field2Name' => 'attributeCode', - 'field2Value' => $attributeCode, + 'field2Value' => $attributeCode ] ) ); diff --git a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php index ed9b8cd25c2a6..6c19f945df5c8 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/AddressRepository.php @@ -257,40 +257,40 @@ private function _validate(CustomerAddressModel $customerAddressModel) } if (!\Zend_Validate::is($customerAddressModel->getFirstname(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'firstname'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'firstname'])); } if (!\Zend_Validate::is($customerAddressModel->getLastname(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'lastname'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'lastname'])); } if (!\Zend_Validate::is($customerAddressModel->getStreetLine(1), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'street'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'street'])); } if (!\Zend_Validate::is($customerAddressModel->getCity(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'city'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'city'])); } if (!\Zend_Validate::is($customerAddressModel->getTelephone(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'telephone'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'telephone'])); } $havingOptionalZip = $this->directoryData->getCountriesWithOptionalZip(); if (!in_array($customerAddressModel->getCountryId(), $havingOptionalZip) && !\Zend_Validate::is($customerAddressModel->getPostcode(), 'NotEmpty') ) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'postcode'])); } if (!\Zend_Validate::is($customerAddressModel->getCountryId(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'countryId'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'countryId'])); } if ($this->directoryData->isRegionRequired($customerAddressModel->getCountryId())) { $regionCollection = $customerAddressModel->getCountryModel()->getRegionCollection(); if (!$regionCollection->count() && empty($customerAddressModel->getRegion())) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'region'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'region'])); } elseif ( $regionCollection->count() && !in_array( @@ -298,7 +298,7 @@ private function _validate(CustomerAddressModel $customerAddressModel) array_column($regionCollection->getData(), 'region_id') ) ) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'regionId'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'regionId'])); } } return $exception; diff --git a/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php b/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php index ca3487ba36ad8..91c3415bf1ca3 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/GroupRepository.php @@ -317,7 +317,7 @@ private function _validate($group) { $exception = new InputException(); if (!\Zend_Validate::is($group->getCode(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code'])); } if ($exception->wasErrorAdded()) { diff --git a/app/code/Magento/Customer/Test/Unit/Block/Account/Dashboard/InfoTest.php b/app/code/Magento/Customer/Test/Unit/Block/Account/Dashboard/InfoTest.php index 3b10c04f80358..fec880799f8e2 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Account/Dashboard/InfoTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Account/Dashboard/InfoTest.php @@ -138,7 +138,7 @@ public function testGetCustomerException() ->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'customerId', 'fieldValue' => 1] ) )) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php index ec39a2dcea529..95b8bd7ce254b 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php @@ -134,7 +134,7 @@ public function testIsEnabledWithException() ->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -161,7 +161,7 @@ public function testIsRequiredWithException() ->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -385,7 +385,7 @@ public function testGetMinDateRangeWithException() ->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -454,7 +454,7 @@ public function testGetMaxDateRangeWithException() ->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php index 3a42e62a1d364..99072960d22e0 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/GenderTest.php @@ -95,7 +95,7 @@ public function testIsEnabledWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -136,7 +136,7 @@ public function testIsRequiredWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/NameTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/NameTest.php index 5e11d60040d19..48dccbbbbfed1 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/NameTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/NameTest.php @@ -128,7 +128,7 @@ public function testShowPrefixWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -149,7 +149,7 @@ public function testMethodWithNoSuchEntityException($method) )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -398,7 +398,7 @@ public function testGetStoreLabelWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) diff --git a/app/code/Magento/Customer/Test/Unit/Block/Widget/TaxvatTest.php b/app/code/Magento/Customer/Test/Unit/Block/Widget/TaxvatTest.php index dc685adf2d5de..c6e093a365d01 100644 --- a/app/code/Magento/Customer/Test/Unit/Block/Widget/TaxvatTest.php +++ b/app/code/Magento/Customer/Test/Unit/Block/Widget/TaxvatTest.php @@ -82,7 +82,7 @@ public function testIsEnabledWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) @@ -120,7 +120,7 @@ public function testIsRequiredWithException() )->will( $this->throwException(new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) )) diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ResetPasswordTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ResetPasswordTest.php index 6202455a41c4d..3cded12552b34 100644 --- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ResetPasswordTest.php +++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/ResetPasswordTest.php @@ -266,7 +266,7 @@ public function testResetPasswordActionInvalidCustomerId() $this->throwException( new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'customerId', 'fieldValue' => $customerId] ) ) diff --git a/app/code/Magento/Customer/etc/adminhtml/system.xml b/app/code/Magento/Customer/etc/adminhtml/system.xml index 9f74fda88bda9..78e11418bcf11 100644 --- a/app/code/Magento/Customer/etc/adminhtml/system.xml +++ b/app/code/Magento/Customer/etc/adminhtml/system.xml @@ -18,7 +18,7 @@ 1 - + Magento\Customer\Model\Config\Share Magento\Customer\Model\Config\Share @@ -30,14 +30,14 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Customer\Model\Config\Source\Address\Type 1 - + Magento\Customer\Model\Config\Source\Group @@ -81,20 +81,20 @@ Magento\Config\Model\Config\Source\Yesno Magento\Customer\Model\Config\Backend\CreateAccount\DisableAutoGroupAssignDefault - + To show VAT number on Storefront, set Show VAT Number on Storefront option to Yes. Magento\Config\Model\Config\Source\Yesno - + - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - +
@@ -102,20 +102,20 @@ ]]>
Magento\Config\Model\Config\Source\Email\Template
- + Magento\Config\Model\Config\Source\Email\Identity - + Magento\Config\Model\Config\Source\Yesno - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - +
@@ -130,47 +130,47 @@
- + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Email\Identity - + Please enter a number 1 or greater in this field. required-entry validate-digits validate-digits-range digits-range-1- Magento\Customer\Model\Config\Backend\Password\Link\Expirationperiod - + Number of different character classes required in password: Lowercase, Uppercase, Digits, Special Characters. required-entry validate-digits validate-digits-range digits-range-1-4 - + Please enter a number 1 or greater in this field. required-entry validate-digits validate-digits-range digits-range-1- - + Use 0 to disable account locking. required-entry validate-digits - + Account will be unlocked after provided time. required-entry validate-digits @@ -178,7 +178,7 @@ - + Magento\Customer\Model\Config\Backend\Address\Street Leave empty for default (2). Valid range: 1-4 @@ -231,7 +231,7 @@ - + Magento\Config\Model\Config\Source\Yesno Customer will stay on the current page if "No" is selected. @@ -239,16 +239,16 @@ - + - + - + - + @@ -268,7 +268,7 @@
- + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Developer/etc/adminhtml/system.xml b/app/code/Magento/Developer/etc/adminhtml/system.xml index 4d2f89d2e0474..551704598ee70 100644 --- a/app/code/Magento/Developer/etc/adminhtml/system.xml +++ b/app/code/Magento/Developer/etc/adminhtml/system.xml @@ -9,7 +9,7 @@
- + Not available in production mode Magento\Developer\Model\Config\Source\WorkflowType diff --git a/app/code/Magento/Dhl/etc/adminhtml/system.xml b/app/code/Magento/Dhl/etc/adminhtml/system.xml index 876666c75501a..4f28555021d99 100644 --- a/app/code/Magento/Dhl/etc/adminhtml/system.xml +++ b/app/code/Magento/Dhl/etc/adminhtml/system.xml @@ -10,14 +10,14 @@
- + Magento\Config\Model\Config\Source\Yesno - + - + @@ -28,18 +28,18 @@ Magento\Config\Model\Config\Backend\Encrypted - + - + Magento\Dhl\Model\Source\Contenttype - + Magento\Shipping\Model\Source\HandlingType - + "Per Order" allows a single handling fee for the entire order. "Per Package" allows an individual handling fee for each package. Magento\Shipping\Model\Source\HandlingAction @@ -48,17 +48,17 @@ validate-number validate-zero-or-greater - + Select this to allow DHL to optimize shipping charges by splitting the order if it exceeds 70 kg. Magento\Config\Model\Config\Source\Yesno - + Magento\Dhl\Model\Source\Method\Unitofmeasure Magento\Dhl\Block\Adminhtml\Unitofmeasure - + Magento\Dhl\Model\Source\Method\Size @@ -80,25 +80,25 @@ 1 - + Magento\Dhl\Model\Source\Method\Doc D - + Magento\Dhl\Model\Source\Method\Nondoc N - + Package ready time after order submission (in hours) - + @@ -128,7 +128,7 @@ 1 - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index 10f212ddb4638..4842881ac3ba1 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -172,19 +172,12 @@ public function load($id, $field = null) /** * Get currency rate (only base => allowed) * - * @param string $toCurrency + * @param mixed $toCurrency * @return float - * @throws \Magento\Framework\Exception\InputException */ public function getRate($toCurrency) { - if (is_string($toCurrency)) { - $code = $toCurrency; - } elseif ($toCurrency instanceof \Magento\Directory\Model\Currency) { - $code = $toCurrency->getCurrencyCode(); - } else { - throw new InputException(__('Please correct the target currency.')); - } + $code = $this->getCurrencyCodeFromToCurrency($toCurrency); $rates = $this->getRates(); if (!isset($rates[$code])) { $rates[$code] = $this->_getResource()->getRate($this->getCode(), $toCurrency); @@ -196,19 +189,12 @@ public function getRate($toCurrency) /** * Get currency rate (base=>allowed or allowed=>base) * - * @param string $toCurrency + * @param mixed $toCurrency * @return float - * @throws \Magento\Framework\Exception\InputException */ public function getAnyRate($toCurrency) { - if (is_string($toCurrency)) { - $code = $toCurrency; - } elseif ($toCurrency instanceof \Magento\Directory\Model\Currency) { - $code = $toCurrency->getCurrencyCode(); - } else { - throw new InputException(__('Please correct the target currency.')); - } + $code = $this->getCurrencyCodeFromToCurrency($toCurrency); $rates = $this->getRates(); if (!isset($rates[$code])) { $rates[$code] = $this->_getResource()->getAnyRate($this->getCode(), $toCurrency); @@ -221,7 +207,7 @@ public function getAnyRate($toCurrency) * Convert price to currency format * * @param float $price - * @param string $toCurrency + * @param mixed $toCurrency * @return float * @throws \Exception */ @@ -233,7 +219,28 @@ public function convert($price, $toCurrency = null) return $price * $rate; } - throw new \Exception(__('Undefined rate from "%1-%2".', $this->getCode(), $toCurrency->getCode())); + throw new \Exception(__( + 'Undefined rate from "%1-%2".', + $this->getCode(), + $this->getCurrencyCodeFromToCurrency($toCurrency) + )); + } + + /** + * @param mixed $toCurrency + * @return string + * @throws \Magento\Framework\Exception\InputException + */ + private function getCurrencyCodeFromToCurrency($toCurrency) + { + if (is_string($toCurrency)) { + $code = $toCurrency; + } elseif ($toCurrency instanceof \Magento\Directory\Model\Currency) { + $code = $toCurrency->getCurrencyCode(); + } else { + throw new InputException(__('Please correct the target currency.')); + } + return $code; } /** diff --git a/app/code/Magento/Directory/etc/adminhtml/system.xml b/app/code/Magento/Directory/etc/adminhtml/system.xml index bcad212ee9dd8..aacef0d8ff6e1 100644 --- a/app/code/Magento/Directory/etc/adminhtml/system.xml +++ b/app/code/Magento/Directory/etc/adminhtml/system.xml @@ -13,7 +13,7 @@ Magento_Backend::currency - + Magento\Directory\Block\Adminhtml\Frontend\Currency\Base Magento\Config\Model\Config\Source\Locale\Currency @@ -22,12 +22,12 @@ "Price" > "Catalog Price Scope").]]> - + Magento\Config\Model\Config\Source\Locale\Currency Magento\Config\Model\Config\Backend\Currency\DefaultCurrency - + Magento\Config\Model\Config\Source\Locale\Currency Magento\Config\Model\Config\Backend\Currency\Allow @@ -36,13 +36,13 @@ - + - + Magento\Config\Model\Config\Source\Yesno @@ -50,11 +50,11 @@ validate-email - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -76,7 +76,7 @@
- + Magento\Config\Model\Config\Backend\Locale Magento\Config\Model\Config\Source\Locale\Currency\All @@ -86,7 +86,7 @@
- + Magento\Directory\Model\Config\Source\Country 1 @@ -104,7 +104,7 @@ - + Magento\Directory\Model\Config\Source\WeightUnit diff --git a/app/code/Magento/Downloadable/etc/adminhtml/system.xml b/app/code/Magento/Downloadable/etc/adminhtml/system.xml index 445cc68c15192..2fdf6be5b88c3 100644 --- a/app/code/Magento/Downloadable/etc/adminhtml/system.xml +++ b/app/code/Magento/Downloadable/etc/adminhtml/system.xml @@ -10,24 +10,24 @@
- + Magento\Downloadable\Model\System\Config\Source\Orderitemstatus - + Magento\Config\Model\Config\Source\Yesno - + - + - + Magento\Config\Model\Config\Source\Yesno @@ -35,7 +35,7 @@ Magento\Downloadable\Model\System\Config\Source\Contentdisposition - + Magento\Config\Model\Config\Source\Yesno Guest checkout will only work with shareable. diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index 49a4782e5583c..ae230ca193a98 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -48,14 +48,8 @@ - - Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE - - - - Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface - - + + diff --git a/app/code/Magento/Fedex/etc/adminhtml/system.xml b/app/code/Magento/Fedex/etc/adminhtml/system.xml index 241e8b2226854..1de61c2c15494 100644 --- a/app/code/Magento/Fedex/etc/adminhtml/system.xml +++ b/app/code/Magento/Fedex/etc/adminhtml/system.xml @@ -10,11 +10,11 @@
- + Magento\Config\Model\Config\Source\Yesno - + @@ -34,47 +34,47 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Config\Model\Config\Source\Yesno - + 0 - + 1 - + Magento\Shipping\Model\Config\Source\Online\Requesttype - + Magento\Fedex\Model\Source\Packaging - + Magento\Fedex\Model\Source\Dropoff - + Magento\Fedex\Model\Source\Unitofmeasure - + validate-number validate-zero-or-greater - + Magento\Shipping\Model\Source\HandlingType - + Magento\Shipping\Model\Source\HandlingAction @@ -86,7 +86,7 @@ Magento\Config\Model\Config\Source\Yesno - + Magento\Fedex\Model\Source\Method 1 @@ -95,7 +95,7 @@ The field is applicable if the Smart Post method is selected. - + free-method Magento\Fedex\Model\Source\Freemethod @@ -111,10 +111,10 @@ 1 - + - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries diff --git a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml index 52ca2b0bc4e32..89228928a651a 100644 --- a/app/code/Magento/GiftMessage/etc/adminhtml/system.xml +++ b/app/code/Magento/GiftMessage/etc/adminhtml/system.xml @@ -10,11 +10,11 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml b/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml index b99cfc1c77d24..fbedc21a7337d 100644 --- a/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml +++ b/app/code/Magento/GoogleAdwords/etc/adminhtml/system.xml @@ -10,7 +10,7 @@
- + Magento\Config\Model\Config\Source\Yesno @@ -21,20 +21,20 @@ 1 - + Magento\GoogleAdwords\Model\Config\Source\Language 1 - + 1 - + Magento\GoogleAdwords\Model\Config\Backend\Color @@ -47,14 +47,14 @@ 1 - + Magento\GoogleAdwords\Model\Config\Source\ValueType 1 - + 1 diff --git a/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml b/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml index 9777c096c593f..b8a6c6b51de28 100644 --- a/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml +++ b/app/code/Magento/GroupedProduct/etc/adminhtml/system.xml @@ -9,7 +9,7 @@
- + Magento\Catalog\Model\Config\Source\Product\Thumbnail diff --git a/app/code/Magento/Integration/Model/CredentialsValidator.php b/app/code/Magento/Integration/Model/CredentialsValidator.php index d4ed278a016df..79e19971a5b35 100644 --- a/app/code/Magento/Integration/Model/CredentialsValidator.php +++ b/app/code/Magento/Integration/Model/CredentialsValidator.php @@ -25,10 +25,10 @@ public function validate($username, $password) { $exception = new InputException(); if (!is_string($username) || strlen($username) == 0) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'username'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'username'])); } if (!is_string($password) || strlen($password) == 0) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'password'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'password'])); } if ($exception->wasErrorAdded()) { throw $exception; diff --git a/app/code/Magento/Integration/etc/adminhtml/system.xml b/app/code/Magento/Integration/etc/adminhtml/system.xml index 427369085bdff..08781e696b5b7 100644 --- a/app/code/Magento/Integration/etc/adminhtml/system.xml +++ b/app/code/Magento/Integration/etc/adminhtml/system.xml @@ -13,26 +13,26 @@ Magento_Integration::config_oauth - + Integer. Launch cleanup in X OAuth requests. 0 (not recommended) - to disable cleanup - + Cleanup entries older than X minutes. - + Consumer key/secret will expire if not used within X seconds after Oauth token exchange starts. - + Number of maximum redirects for OAuth consumer credentials Post request. - + Timeout for OAuth consumer credentials Post request within X seconds. diff --git a/app/code/Magento/LayeredNavigation/etc/adminhtml/system.xml b/app/code/Magento/LayeredNavigation/etc/adminhtml/system.xml index 85b7f4b920983..ef90d4664dff7 100644 --- a/app/code/Magento/LayeredNavigation/etc/adminhtml/system.xml +++ b/app/code/Magento/LayeredNavigation/etc/adminhtml/system.xml @@ -10,22 +10,22 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Catalog\Model\Config\Source\Price\Step - + validate-number validate-number-range number-range-0.01-1000000000 manual - + Maximum number of price intervals is 100 validate-digits validate-digits-range digits-range-2-100 @@ -33,7 +33,7 @@ manual - + This setting will be applied when all prices in the specific price interval are equal. Magento\Config\Model\Config\Source\Yesno @@ -41,7 +41,7 @@ improved - + Please specify the number of products, that will not be divided into subintervals. validate-digits validate-digits-range digits-range-1-10000 diff --git a/app/code/Magento/MediaStorage/etc/adminhtml/system.xml b/app/code/Magento/MediaStorage/etc/adminhtml/system.xml index 38d1490500ce8..c0626934a0f45 100644 --- a/app/code/Magento/MediaStorage/etc/adminhtml/system.xml +++ b/app/code/Magento/MediaStorage/etc/adminhtml/system.xml @@ -10,11 +10,11 @@
- + Magento\MediaStorage\Model\Config\Source\Storage\Media\Storage - + Magento\MediaStorage\Model\Config\Source\Storage\Media\Database Magento\MediaStorage\Model\Config\Backend\Storage\Media\Database @@ -26,7 +26,7 @@ Magento\MediaStorage\Block\System\Config\System\Storage\Media\Synchronize After selecting a new media storage location, press the Synchronize button to transfer all media to that location. Media will not be available in the new location until the synchronization process is complete. - + diff --git a/app/code/Magento/Msrp/etc/adminhtml/system.xml b/app/code/Magento/Msrp/etc/adminhtml/system.xml index c96d866e48857..851a6e1f5519f 100644 --- a/app/code/Magento/Msrp/etc/adminhtml/system.xml +++ b/app/code/Magento/Msrp/etc/adminhtml/system.xml @@ -10,21 +10,21 @@
- + Magento\Config\Model\Config\Source\Yesno Warning! Enabling MAP by default will hide all product prices on Storefront.]]> - + Magento\Msrp\Model\Product\Attribute\Source\Type - + - + diff --git a/app/code/Magento/Multishipping/etc/adminhtml/system.xml b/app/code/Magento/Multishipping/etc/adminhtml/system.xml index a9b08927cf5d5..2f3d5faf99727 100644 --- a/app/code/Magento/Multishipping/etc/adminhtml/system.xml +++ b/app/code/Magento/Multishipping/etc/adminhtml/system.xml @@ -13,11 +13,11 @@ Magento_Multishipping::config_multishipping - + Magento\Config\Model\Config\Source\Yesno - + validate-number diff --git a/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml b/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml index 5163d40f4f069..313f4874657bb 100644 --- a/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml +++ b/app/code/Magento/NewRelicReporting/etc/adminhtml/system.xml @@ -13,14 +13,14 @@ Magento_NewRelicReporting::config_newrelicreporting - + Magento\Config\Model\Config\Source\Yesno - + - + Use %s to replace the account ID in the URL @@ -49,7 +49,7 @@ - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Newsletter/Test/Unit/Controller/Manage/SaveTest.php b/app/code/Magento/Newsletter/Test/Unit/Controller/Manage/SaveTest.php index 62042abb4692d..68b3078753abc 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Controller/Manage/SaveTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Controller/Manage/SaveTest.php @@ -142,7 +142,7 @@ public function testSaveActionWithException() ->will($this->throwException( new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'customerId', 'value' => 'value'] ) ) diff --git a/app/code/Magento/Newsletter/etc/adminhtml/system.xml b/app/code/Magento/Newsletter/etc/adminhtml/system.xml index 677f24ec5b237..faa7576ac5a21 100644 --- a/app/code/Magento/Newsletter/etc/adminhtml/system.xml +++ b/app/code/Magento/Newsletter/etc/adminhtml/system.xml @@ -13,37 +13,37 @@ Magento_Newsletter::newsletter - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template diff --git a/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml b/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml index d459f3ba14237..6251f7de9e457 100644 --- a/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml +++ b/app/code/Magento/OfflinePayments/etc/adminhtml/system.xml @@ -10,11 +10,11 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Sales\Model\Config\Source\Order\Status\NewStatus @@ -22,10 +22,10 @@ validate-number - + - + Magento\Payment\Model\Config\Source\Allspecificcountries @@ -50,11 +50,11 @@ - + Magento\Config\Model\Config\Source\Yesno - + Magento\Sales\Model\Config\Source\Order\Status\NewStatus @@ -62,10 +62,10 @@ validate-number - + - + Magento\Payment\Model\Config\Source\Allspecificcountries @@ -84,18 +84,18 @@ - + Magento\Config\Model\Config\Source\Yesno - + - + Magento\Sales\Model\Config\Source\Order\Status\NewStatus - + Magento\Payment\Model\Config\Source\Allspecificcountries @@ -119,18 +119,18 @@ - + Magento\Config\Model\Config\Source\Yesno - + - + Magento\Sales\Model\Config\Source\Order\Status\NewStatus - + Magento\Payment\Model\Config\Source\Allspecificcountries @@ -154,29 +154,29 @@ - + Magento\Config\Model\Config\Source\Yesno - + Magento\Sales\Model\Config\Source\Order\Status\Newprocessing - + Magento\Payment\Model\Source\Invoice processing - + validate-number - + - + Magento\Payment\Model\Config\Source\Allspecificcountries diff --git a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml index b34764726204b..50ed4cdc94178 100644 --- a/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml +++ b/app/code/Magento/OfflineShipping/etc/adminhtml/system.xml @@ -10,36 +10,36 @@
- + Magento\Config\Model\Config\Source\Yesno - + - + validate-number validate-zero-or-greater - + Magento\Shipping\Model\Source\HandlingType - + validate-number validate-zero-or-greater - + - + Magento\OfflineShipping\Model\Config\Source\Flatrate - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries @@ -53,13 +53,13 @@ Magento\Config\Model\Config\Source\Yesno - + - + Magento\Shipping\Model\Source\HandlingType @@ -67,15 +67,15 @@ validate-number validate-zero-or-greater - + Magento\Config\Model\Config\Source\Yesno - + Magento\OfflineShipping\Model\Config\Source\Tablerate - + Magento\Config\Model\Config\Source\Yesno @@ -86,16 +86,16 @@ Magento\OfflineShipping\Model\Config\Backend\Tablerate - + - + - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries @@ -110,13 +110,13 @@ shipping-skip-hide Magento\Config\Model\Config\Source\Yesno - + - + Magento\Config\Model\Config\Source\Yesno @@ -124,16 +124,16 @@ validate-number validate-zero-or-greater - + - + - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries @@ -147,7 +147,7 @@ Magento\Config\Model\Config\Source\Yesno - + diff --git a/app/code/Magento/PageCache/etc/adminhtml/system.xml b/app/code/Magento/PageCache/etc/adminhtml/system.xml index f8f6557e84e6f..92bc32086a979 100644 --- a/app/code/Magento/PageCache/etc/adminhtml/system.xml +++ b/app/code/Magento/PageCache/etc/adminhtml/system.xml @@ -10,7 +10,7 @@
- + Magento\PageCache\Model\System\Config\Source\Application @@ -58,7 +58,7 @@ 2 - + Public content cache lifetime in seconds. If field is empty default value 86400 will be saved. Magento\PageCache\Model\System\Config\Backend\Ttl diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index 6543ef7ebbc50..752b6ab511110 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -398,12 +398,16 @@ protected function _getOrderFromResponse() $order->getState() != \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT || !$amountCompared ) { - throw new \Magento\Framework\Exception\LocalizedException(__(self::RESPONSE_ERROR_MSG, 'Order')); + throw new \Magento\Framework\Exception\LocalizedException( + __('Payment error. %value was not found.', ['value' => 'Order']) + ); } $fetchData = $this->fetchTransactionInfo($order->getPayment(), $response->getPnref()); if (!isset($fetchData['custref']) || $fetchData['custref'] != $order->getIncrementId()) { - throw new \Magento\Framework\Exception\LocalizedException(__(self::RESPONSE_ERROR_MSG, 'Transaction')); + throw new \Magento\Framework\Exception\LocalizedException( + __('Payment error. %value was not found.', ['value' => 'Transaction']) + ); } return $order; diff --git a/app/code/Magento/Persistent/etc/adminhtml/system.xml b/app/code/Magento/Persistent/etc/adminhtml/system.xml index 6b481a2f256d6..06a0579896c05 100644 --- a/app/code/Magento/Persistent/etc/adminhtml/system.xml +++ b/app/code/Magento/Persistent/etc/adminhtml/system.xml @@ -14,39 +14,39 @@ Magento_Persistent::persistent - + Magento\Config\Model\Config\Source\Yesno - + validate-digits validate-digits-range digits-range-0-3153600000 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno 1 - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml index 8c02ef4a26acb..957e7ac62648d 100644 --- a/app/code/Magento/ProductAlert/etc/adminhtml/system.xml +++ b/app/code/Magento/ProductAlert/etc/adminhtml/system.xml @@ -10,25 +10,25 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Email\Identity @@ -47,11 +47,11 @@ validate-email - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template diff --git a/app/code/Magento/ProductVideo/etc/adminhtml/system.xml b/app/code/Magento/ProductVideo/etc/adminhtml/system.xml index 284a87e96dd76..efa271ca379b8 100644 --- a/app/code/Magento/ProductVideo/etc/adminhtml/system.xml +++ b/app/code/Magento/ProductVideo/etc/adminhtml/system.xml @@ -13,15 +13,15 @@ - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Quote/etc/di.xml b/app/code/Magento/Quote/etc/di.xml index ae76101969f48..80446c2bcce64 100644 --- a/app/code/Magento/Quote/etc/di.xml +++ b/app/code/Magento/Quote/etc/di.xml @@ -20,7 +20,6 @@ - diff --git a/app/code/Magento/Reports/etc/adminhtml/system.xml b/app/code/Magento/Reports/etc/adminhtml/system.xml index 70cd7574cdd08..acd8dfb8f068b 100644 --- a/app/code/Magento/Reports/etc/adminhtml/system.xml +++ b/app/code/Magento/Reports/etc/adminhtml/system.xml @@ -10,15 +10,15 @@
- + Magento\Config\Model\Config\Source\Reports\Scope 1 - + - + @@ -29,11 +29,11 @@ Magento_Reports::reports - + Magento\Reports\Block\Adminhtml\Config\Form\Field\YtdStart - + Magento\Reports\Block\Adminhtml\Config\Form\Field\MtdStart Select day of the month. diff --git a/app/code/Magento/Review/etc/adminhtml/system.xml b/app/code/Magento/Review/etc/adminhtml/system.xml index aee039096318c..b7059a8f6a868 100644 --- a/app/code/Magento/Review/etc/adminhtml/system.xml +++ b/app/code/Magento/Review/etc/adminhtml/system.xml @@ -10,7 +10,7 @@
- + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php index e9226dcc049e8..dcae979164e70 100644 --- a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php +++ b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php @@ -47,7 +47,7 @@ public function toOptionArray() ? $this->_orderConfig->getStateStatuses($this->_stateStatuses) : $this->_orderConfig->getStatuses(); - $options = [['value' => '', 'label' => __(self::UNDEFINED_OPTION_LABEL)]]; + $options = [['value' => '', 'label' => __('-- Please Select --')]]; foreach ($statuses as $code => $label) { $options[] = ['value' => $code, 'label' => $label]; } diff --git a/app/code/Magento/Sales/etc/adminhtml/system.xml b/app/code/Magento/Sales/etc/adminhtml/system.xml index fe2023d00809d..114349ed77696 100644 --- a/app/code/Magento/Sales/etc/adminhtml/system.xml +++ b/app/code/Magento/Sales/etc/adminhtml/system.xml @@ -25,25 +25,25 @@ - + - + - + - + - + - + Magento\Config\Model\Config\Source\Yesno @@ -82,7 +82,7 @@ Subtotal after discount - + Magento\Config\Model\Config\Source\Yesno @@ -108,7 +108,7 @@ - + Magento\Config\Model\Config\Source\Yesno Improves dashboard performance but provides non-realtime data. @@ -116,7 +116,7 @@ - + @@ -127,7 +127,7 @@ Magento_Sales::sales_email - + Magento\Config\Model\Config\Source\Enabledisable Magento\Sales\Model\Config\Backend\Email\AsyncSending @@ -135,20 +135,20 @@ - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -157,27 +157,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -186,27 +186,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -215,27 +215,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -244,27 +244,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -273,27 +273,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -302,27 +302,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -331,27 +331,27 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -360,7 +360,7 @@ Comma-separated - + Magento\Config\Model\Config\Source\Email\Method @@ -372,21 +372,21 @@ Magento_Sales::sales_pdf - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -404,7 +404,7 @@
- + Magento\Config\Model\Config\Source\Enabledisable Magento\Sales\Model\Config\Backend\Grid\AsyncIndexing diff --git a/app/code/Magento/SalesRule/etc/adminhtml/system.xml b/app/code/Magento/SalesRule/etc/adminhtml/system.xml index ed2d66d1d440b..03cb3d1effffd 100644 --- a/app/code/Magento/SalesRule/etc/adminhtml/system.xml +++ b/app/code/Magento/SalesRule/etc/adminhtml/system.xml @@ -14,12 +14,12 @@ Magento_SalesRule::config_promo - + Excluding prefix, suffix and separators. validate-digits - + Magento\SalesRule\Model\System\Config\Source\Coupon\Format diff --git a/app/code/Magento/Security/etc/adminhtml/system.xml b/app/code/Magento/Security/etc/adminhtml/system.xml index 76fa417c3bc0c..0180874d8ff09 100644 --- a/app/code/Magento/Security/etc/adminhtml/system.xml +++ b/app/code/Magento/Security/etc/adminhtml/system.xml @@ -9,16 +9,16 @@
- + If set to Yes, you can log in from multiple computers into same account. Default setting No improves security. Magento\Config\Model\Config\Source\Yesno - + Magento\Security\Model\Config\Source\ResetMethod - + Limit the number of password reset request per hour. Use 0 to disable. required-entry validate-zero-or-greater @@ -26,7 +26,7 @@ 0 - + Delay in minutes between password reset requests. Use 0 to disable. required-entry validate-zero-or-greater @@ -38,11 +38,11 @@
- + Magento\Security\Model\Config\Source\ResetMethod - + Limit the number of password reset request per hour. Use 0 to disable. required-entry validate-zero-or-greater @@ -50,7 +50,7 @@ 0 - + Delay in minutes between password reset requests. Use 0 to disable. required-entry validate-zero-or-greater diff --git a/app/code/Magento/SendFriend/etc/adminhtml/system.xml b/app/code/Magento/SendFriend/etc/adminhtml/system.xml index 7c925f518943a..241b9b6cedd4b 100644 --- a/app/code/Magento/SendFriend/etc/adminhtml/system.xml +++ b/app/code/Magento/SendFriend/etc/adminhtml/system.xml @@ -13,28 +13,28 @@ Magento_Backend::sendfriend - + Magento\Config\Model\Config\Source\Yesno - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + Magento\Config\Model\Config\Source\Yesno - + validate-digits - + validate-digits - + Magento\SendFriend\Model\Source\Checktype diff --git a/app/code/Magento/Shipping/etc/adminhtml/system.xml b/app/code/Magento/Shipping/etc/adminhtml/system.xml index e162c310280b0..bd81103b1971c 100644 --- a/app/code/Magento/Shipping/etc/adminhtml/system.xml +++ b/app/code/Magento/Shipping/etc/adminhtml/system.xml @@ -13,15 +13,15 @@ Magento_Shipping::config_shipping - + countries Magento\Directory\Model\Config\Source\Country - + - + diff --git a/app/code/Magento/Sitemap/etc/adminhtml/system.xml b/app/code/Magento/Sitemap/etc/adminhtml/system.xml index d1501c284846f..d29550bec28f6 100644 --- a/app/code/Magento/Sitemap/etc/adminhtml/system.xml +++ b/app/code/Magento/Sitemap/etc/adminhtml/system.xml @@ -13,11 +13,11 @@ Magento_Sitemap::config_sitemap - + Magento\Sitemap\Model\Config\Source\Frequency - + Magento\Sitemap\Model\Config\Backend\Priority Valid values range from 0.0 to 1.0. @@ -25,27 +25,27 @@ - + Magento\Sitemap\Model\Config\Source\Frequency - + Magento\Sitemap\Model\Config\Backend\Priority Valid values range from 0.0 to 1.0. - + Magento\Sitemap\Model\Source\Product\Image\IncludeImage - + Magento\Sitemap\Model\Config\Source\Frequency - + Magento\Sitemap\Model\Config\Backend\Priority Valid values range from 0.0 to 1.0. @@ -53,7 +53,7 @@ - + Magento\Config\Model\Config\Source\Yesno @@ -61,11 +61,11 @@ validate-email - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template @@ -81,17 +81,17 @@ - + - + File size in bytes. - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Swatches/etc/adminhtml/system.xml b/app/code/Magento/Swatches/etc/adminhtml/system.xml index e856b209ae400..e41eaab6e0d0c 100644 --- a/app/code/Magento/Swatches/etc/adminhtml/system.xml +++ b/app/code/Magento/Swatches/etc/adminhtml/system.xml @@ -9,10 +9,10 @@
- +
- \ No newline at end of file + diff --git a/app/code/Magento/Tax/Model/Calculation/RateRepository.php b/app/code/Magento/Tax/Model/Calculation/RateRepository.php index 315c5e4dd533a..b2d63d99dc885 100644 --- a/app/code/Magento/Tax/Model/Calculation/RateRepository.php +++ b/app/code/Magento/Tax/Model/Calculation/RateRepository.php @@ -240,14 +240,14 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) $countryCode = $taxRate->getTaxCountryId(); if (!\Zend_Validate::is($countryCode, 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'country_id'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'country_id'])); } elseif (!\Zend_Validate::is( $this->countryFactory->create()->loadByCode($countryCode)->getId(), 'NotEmpty' )) { $exception->addError( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', [ 'fieldName' => 'country_id', 'value' => $countryCode @@ -266,18 +266,18 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) ) { $exception->addError( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['fieldName' => 'region_id', 'value' => $regionCode] ) ); } if (!\Zend_Validate::is($taxRate->getRate(), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'percentage_rate'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'percentage_rate'])); } if (!\Zend_Validate::is(trim($taxRate->getCode()), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'code'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'code'])); } if ($taxRate->getZipIsRange()) { @@ -289,7 +289,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) if (!is_numeric($value) || $value < 0) { $exception->addError( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['fieldName' => $key, 'value' => $value] ) ); @@ -300,7 +300,7 @@ private function validate(\Magento\Tax\Api\Data\TaxRateInterface $taxRate) } } else { if (!\Zend_Validate::is(trim($taxRate->getTaxPostcode()), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => 'postcode'])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => 'postcode'])); } } diff --git a/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php b/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php index d63e64f95890c..0cf8d01632369 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php +++ b/app/code/Magento/Tax/Model/Calculation/Rule/Validator.php @@ -43,38 +43,38 @@ public function isValid($value) // Position is required and must be 0 or greater if (!\Zend_Validate::is(trim($value->getPosition()), 'NotEmpty')) { - $this->addErrorMessage($messages, InputException::REQUIRED_FIELD, ['fieldName' => 'position']); + $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'position']); } if (!\Zend_Validate::is(trim($value->getPosition()), 'GreaterThan', [-1])) { $this->addErrorMessage( $messages, - InputException::INVALID_FIELD_MIN_VALUE, + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', ['fieldName' => 'position', 'value' => $value->getPosition(), 'minValue' => 0] ); } // Priority is required and must be 0 or greater if (!\Zend_Validate::is(trim($value->getPriority()), 'NotEmpty')) { - $this->addErrorMessage($messages, InputException::REQUIRED_FIELD, ['fieldName' => 'priority']); + $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'priority']); } if (!\Zend_Validate::is(trim($value->getPriority()), 'GreaterThan', [-1])) { $this->addErrorMessage( $messages, - InputException::INVALID_FIELD_MIN_VALUE, + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', ['fieldName' => 'priority', 'value' => $value->getPriority(), 'minValue' => 0] ); } // Code is required if (!\Zend_Validate::is(trim($value->getCode()), 'NotEmpty')) { - $this->addErrorMessage($messages, InputException::REQUIRED_FIELD, ['fieldName' => 'code']); + $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'code']); } // customer tax class ids is required if (($value->getCustomerTaxClassIds() === null) || !$value->getCustomerTaxClassIds()) { $this->addErrorMessage( $messages, - InputException::REQUIRED_FIELD, + '%fieldName is a required field.', ['fieldName' => 'customer_tax_class_ids'] ); } else { // see if the customer tax class ids exist @@ -85,7 +85,7 @@ public function isValid($value) if ($taxClass === null || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_CUSTOMER)) { $this->addErrorMessage( $messages, - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', [ 'fieldName' => 'customer_tax_class_ids', 'value' => $customerTaxClassId, @@ -104,7 +104,11 @@ public function isValid($value) // product tax class ids is required if (($value->getProductTaxClassIds() === null) || !$value->getProductTaxClassIds()) { - $this->addErrorMessage($messages, InputException::REQUIRED_FIELD, ['fieldName' => 'product_tax_class_ids']); + $this->addErrorMessage( + $messages, + '%fieldName is a required field.', + ['fieldName' => 'product_tax_class_ids'] + ); } else { // see if the product tax class ids exist $productTaxClassIds = $value->getProductTaxClassIds(); foreach ($productTaxClassIds as $productTaxClassId) { @@ -113,7 +117,7 @@ public function isValid($value) if ($taxClass === null || !($taxClass->getClassType() == TaxClassModel::TAX_CLASS_TYPE_PRODUCT)) { $this->addErrorMessage( $messages, - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', [ 'fieldName' => 'product_tax_class_ids', 'value' => $productTaxClassId, @@ -132,7 +136,7 @@ public function isValid($value) // tax rate ids is required if (($value->getTaxRateIds() === null) || !$value->getTaxRateIds()) { - $this->addErrorMessage($messages, InputException::REQUIRED_FIELD, ['fieldName' => 'tax_rate_ids']); + $this->addErrorMessage($messages, '%fieldName is a required field.', ['fieldName' => 'tax_rate_ids']); } $this->_addMessages($messages); return empty($messages); diff --git a/app/code/Magento/Tax/Model/Sales/Order/TaxManagement.php b/app/code/Magento/Tax/Model/Sales/Order/TaxManagement.php index c41b29b07036b..9d2d83572571b 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/TaxManagement.php +++ b/app/code/Magento/Tax/Model/Sales/Order/TaxManagement.php @@ -138,11 +138,8 @@ public function getOrderTaxDetails($orderId) if (!$order) { throw new NoSuchEntityException( __( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, - [ - 'fieldName' => 'orderId', - 'fieldValue' => $orderId, - ] + 'No such entity with %fieldName = %fieldValue', + ['fieldName' => 'orderId', 'fieldValue' => $orderId] ) ); } diff --git a/app/code/Magento/Tax/Model/TaxClass/Repository.php b/app/code/Magento/Tax/Model/TaxClass/Repository.php index 42ec5110be5a9..30fade99f5018 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Repository.php +++ b/app/code/Magento/Tax/Model/TaxClass/Repository.php @@ -171,18 +171,18 @@ protected function validateTaxClassData(\Magento\Tax\Api\Data\TaxClassInterface $exception = new InputException(); if (!\Zend_Validate::is(trim($taxClass->getClassName()), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => ClassModel::KEY_NAME])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => ClassModel::KEY_NAME])); } $classType = $taxClass->getClassType(); if (!\Zend_Validate::is(trim($classType), 'NotEmpty')) { - $exception->addError(__(InputException::REQUIRED_FIELD, ['fieldName' => ClassModel::KEY_TYPE])); + $exception->addError(__('%fieldName is a required field.', ['fieldName' => ClassModel::KEY_TYPE])); } elseif ($classType !== TaxClassManagementInterface::TYPE_CUSTOMER && $classType !== TaxClassManagementInterface::TYPE_PRODUCT ) { $exception->addError( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['fieldName' => ClassModel::KEY_TYPE, 'value' => $classType] ) ); diff --git a/app/code/Magento/Tax/etc/adminhtml/system.xml b/app/code/Magento/Tax/etc/adminhtml/system.xml index 8dc94e16dcd26..87b553dbba57a 100644 --- a/app/code/Magento/Tax/etc/adminhtml/system.xml +++ b/app/code/Magento/Tax/etc/adminhtml/system.xml @@ -14,55 +14,55 @@ Magento_Tax::config_tax - + Magento\Tax\Model\TaxClass\Source\Product - + Magento\Tax\Model\TaxClass\Source\Product Magento\Tax\Model\Config\TaxClass - + Magento\Tax\Model\TaxClass\Source\Customer - + Magento\Tax\Model\System\Config\Source\Algorithm - + Magento\Tax\Model\Config\Source\Basedon Magento\Tax\Model\Config\Notification - + This sets whether catalog prices entered from Magento Admin include tax. Magento\Tax\Model\Config\Price\IncludePrice Magento\Tax\Model\System\Config\Source\PriceType - + This sets whether shipping amounts entered from Magento Admin or obtained from gateways include tax. Magento\Tax\Model\Config\Price\IncludePrice Magento\Tax\Model\System\Config\Source\PriceType - + Magento\Tax\Model\System\Config\Source\Apply Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\PriceType Magento\Tax\Model\Config\Notification Apply discount on price including tax is calculated based on store tax if "Apply Tax after Discount" is selected. - + Magento\Tax\Model\Config\Source\Apply\On @@ -74,11 +74,11 @@ - + Magento\Tax\Model\System\Config\Source\Tax\Country - + Magento\Tax\Block\Adminhtml\Frontend\Region\Updater Magento\Tax\Model\System\Config\Source\Tax\Region @@ -89,12 +89,12 @@ - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification @@ -102,60 +102,60 @@ - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Tax\Model\System\Config\Source\Tax\Display\Type Magento\Tax\Model\Config\Notification - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno diff --git a/app/code/Magento/Theme/etc/adminhtml/system.xml b/app/code/Magento/Theme/etc/adminhtml/system.xml index a5363ea979e99..84773112f504e 100644 --- a/app/code/Magento/Theme/etc/adminhtml/system.xml +++ b/app/code/Magento/Theme/etc/adminhtml/system.xml @@ -10,7 +10,7 @@
- + This will be included before head closing tag in page HTML. Magento\Config\Model\Config\Source\Design\Robots diff --git a/app/code/Magento/Translation/etc/adminhtml/system.xml b/app/code/Magento/Translation/etc/adminhtml/system.xml index 8f8eba958f702..c60ff0db60100 100644 --- a/app/code/Magento/Translation/etc/adminhtml/system.xml +++ b/app/code/Magento/Translation/etc/adminhtml/system.xml @@ -9,7 +9,7 @@
- + Magento\Translation\Model\Js\Config\Source\Strategy Please put your store into maintenance mode and redeploy static files after changing strategy diff --git a/app/code/Magento/Ui/etc/adminhtml/system.xml b/app/code/Magento/Ui/etc/adminhtml/system.xml index f4fe912b3dd0b..7df7570471b39 100644 --- a/app/code/Magento/Ui/etc/adminhtml/system.xml +++ b/app/code/Magento/Ui/etc/adminhtml/system.xml @@ -9,12 +9,12 @@
- + Magento\Config\Model\Config\Source\Yesno If enabled, can be used by functional tests for extended reporting - + Use this key to retrieve collected js errors diff --git a/app/code/Magento/Ups/etc/adminhtml/system.xml b/app/code/Magento/Ups/etc/adminhtml/system.xml index 4d5a816f5f598..dd83ab7c4ed96 100644 --- a/app/code/Magento/Ups/etc/adminhtml/system.xml +++ b/app/code/Magento/Ups/etc/adminhtml/system.xml @@ -14,20 +14,20 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Config\Model\Config\Source\Yesno - + Magento\Ups\Model\Config\Source\Method 1 - + Magento\Shipping\Model\Config\Source\Online\Requesttype - + Magento\Ups\Model\Config\Source\Container @@ -39,26 +39,26 @@ validate-number validate-zero-or-greater - + Magento\Ups\Model\Config\Source\DestType - + free-method Magento\Ups\Model\Config\Source\Freemethod - + - + - + Magento\Shipping\Model\Source\HandlingType - + Magento\Shipping\Model\Source\HandlingAction @@ -66,15 +66,15 @@ validate-number validate-zero-or-greater - + validate-number validate-zero-or-greater - + validate-number validate-zero-or-greater - + Magento\Ups\Model\Config\Source\OriginShipment @@ -82,28 +82,28 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Ups\Model\Config\Source\Pickup - + - + - + Magento\Ups\Model\Config\Source\Type - + Magento\Config\Model\Config\Source\Yesno - + Magento\Ups\Model\Config\Source\Unitofmeasure @@ -111,7 +111,7 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Config\Model\Config\Source\Yesno @@ -119,7 +119,7 @@ Required for negotiated rates; 6-character UPS - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries @@ -134,10 +134,10 @@ shipping-skip-hide Magento\Config\Model\Config\Source\Yesno - + - + This enables or disables SSL verification of the Magento server by UPS. Magento\Shipping\Model\Config\Source\Online\Mode diff --git a/app/code/Magento/User/etc/adminhtml/system.xml b/app/code/Magento/User/etc/adminhtml/system.xml index 05324808a6c23..3c0c016cfae7c 100644 --- a/app/code/Magento/User/etc/adminhtml/system.xml +++ b/app/code/Magento/User/etc/adminhtml/system.xml @@ -9,28 +9,28 @@
- + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + We will disable this feature if the value is empty. validate-zero-or-greater validate-digits - + validate-zero-or-greater validate-digits - + We will disable this feature if the value is empty. validate-zero-or-greater validate-digits - + Magento\User\Model\System\Config\Source\Password diff --git a/app/code/Magento/Usps/etc/adminhtml/system.xml b/app/code/Magento/Usps/etc/adminhtml/system.xml index 91c6a8a7d4d1c..c7b2ce413387f 100644 --- a/app/code/Magento/Usps/etc/adminhtml/system.xml +++ b/app/code/Magento/Usps/etc/adminhtml/system.xml @@ -10,17 +10,17 @@
- + Magento\Config\Model\Config\Source\Yesno - + - + - + @@ -31,19 +31,19 @@ Magento\Config\Model\Config\Backend\Encrypted - + Magento\Shipping\Model\Config\Source\Online\Mode - + Magento\Shipping\Model\Config\Source\Online\Requesttype - + Magento\Usps\Model\Source\Container - + Magento\Usps\Model\Source\Size @@ -71,19 +71,19 @@ LARGE - + Magento\Usps\Model\Source\Machinable - + validate-number validate-zero-or-greater - + Magento\Shipping\Model\Source\HandlingType - + Magento\Shipping\Model\Source\HandlingAction @@ -91,12 +91,12 @@ validate-number validate-zero-or-greater - + Magento\Usps\Model\Source\Method 1 - + free-method Magento\Usps\Model\Source\Freemethod @@ -112,10 +112,10 @@ 1 - + - + shipping-applicable-country Magento\Shipping\Model\Config\Source\Allspecificcountries diff --git a/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php b/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php index 6f859e3353146..810a8c5242da8 100644 --- a/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php +++ b/app/code/Magento/Vault/Plugin/PaymentVaultAttributesLoad.php @@ -59,7 +59,9 @@ public function aroundGetExtensionAttributes( $paymentToken = $paymentExtension->getVaultPaymentToken(); if ($paymentToken === null) { $paymentToken = $this->paymentTokenManagement->getByPaymentId($payment->getEntityId()); - $paymentExtension->setVaultPaymentToken($paymentToken); + if ($paymentToken instanceof \Magento\Vault\Api\Data\PaymentTokenInterface) { + $paymentExtension->setVaultPaymentToken($paymentToken); + } $payment->setExtensionAttributes($paymentExtension); } diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index 17e10223eb36f..5f946a4160195 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -261,7 +261,7 @@ protected function checkPermissions() if (!$this->authorization->isAllowed($route->getAclResources())) { $params = ['resources' => implode(', ', $route->getAclResources())]; throw new AuthorizationException( - __(AuthorizationException::NOT_AUTHORIZED, $params) + __('Consumer is not authorized to access %resources', $params) ); } } diff --git a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php index 7fc2837131a5e..83cadc1320e08 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Request/Handler.php @@ -110,7 +110,7 @@ public function __call($operation, $arguments) if (!$this->authorization->isAllowed($serviceMethodInfo[ServiceMetadata::KEY_ACL_RESOURCES])) { throw new AuthorizationException( __( - AuthorizationException::NOT_AUTHORIZED, + 'Consumer is not authorized to access %resources', ['resources' => implode(', ', $serviceMethodInfo[ServiceMetadata::KEY_ACL_RESOURCES])] ) ); diff --git a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php index 038f5cdcfc444..249ad9fd1fca2 100644 --- a/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php +++ b/app/code/Magento/Webapi/Model/Soap/Wsdl/Generator.php @@ -375,7 +375,7 @@ protected function getAllowedServicesMetadata($requestedServices) if (!$allowedServicesMetadata) { throw new AuthorizationException( __( - AuthorizationException::NOT_AUTHORIZED, + 'Consumer is not authorized to access %resources', ['resources' => implode(', ', $requestedServices)] ) ); diff --git a/app/code/Magento/Webapi/etc/di.xml b/app/code/Magento/Webapi/etc/di.xml index 55b3ea3494c08..484423d010f1f 100644 --- a/app/code/Magento/Webapi/etc/di.xml +++ b/app/code/Magento/Webapi/etc/di.xml @@ -6,7 +6,6 @@ */ --> - diff --git a/app/code/Magento/Weee/etc/adminhtml/system.xml b/app/code/Magento/Weee/etc/adminhtml/system.xml index b242e4d29d060..d3913e1b1890b 100644 --- a/app/code/Magento/Weee/etc/adminhtml/system.xml +++ b/app/code/Magento/Weee/etc/adminhtml/system.xml @@ -10,31 +10,31 @@
- + Magento\Config\Model\Config\Source\Yesno - + Magento\Weee\Model\Config\Source\Display - + Magento\Weee\Model\Config\Source\Display - + Magento\Weee\Model\Config\Source\Display - + Magento\Weee\Model\Config\Source\Display - + Magento\Config\Model\Config\Source\Yesno - + Magento\Config\Model\Config\Source\Yesno @@ -42,7 +42,7 @@
- + diff --git a/app/code/Magento/Wishlist/etc/adminhtml/system.xml b/app/code/Magento/Wishlist/etc/adminhtml/system.xml index 42e806af3b1c5..8e77914c54b63 100644 --- a/app/code/Magento/Wishlist/etc/adminhtml/system.xml +++ b/app/code/Magento/Wishlist/etc/adminhtml/system.xml @@ -13,21 +13,21 @@ Magento_Wishlist::config_wishlist - + Magento\Config\Model\Config\Source\Email\Identity - + Email template chosen based on theme fallback when "Default" option is selected. Magento\Config\Model\Config\Source\Email\Template - + 10 by default. Max - 10000 validate-digits validate-digits-range digits-range-1-10000 - + 255 by default validate-digits validate-digits-range digits-range-1-10000 @@ -35,7 +35,7 @@ - + Magento\Config\Model\Config\Source\Yesno diff --git a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php index b0cd857812e13..ed446d59955ff 100644 --- a/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php +++ b/dev/tests/api-functional/_files/Magento/TestModule3/Service/V1/Error.php @@ -104,7 +104,7 @@ public function inputException($wrappedErrorParameters) foreach ($wrappedErrorParameters as $error) { $exception->addError( __( - InputException::INVALID_FIELD_VALUE, + 'Invalid value of "%value" provided for the %fieldName field.', ['fieldName' => $error->getFieldName(), 'value' => $error->getValue()] ) ); diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php index 396a3e44fdde3..48dd7e4780c0c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementTest.php @@ -351,16 +351,16 @@ public function testInitiatePasswordMissingRequiredFields() $this->assertEquals(\Magento\Framework\Webapi\Exception::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => InputException::DEFAULT_MESSAGE, + 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'email', ], ], [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'template', ] @@ -429,7 +429,7 @@ public function testSendPasswordResetLinkBadEmailOrWebsite() if (TESTS_WEB_API_ADAPTER == self::ADAPTER_REST) { $errorObj = $this->processRestExceptionResult($e); $this->assertEquals( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', $errorObj['message'] ); $this->assertEquals($expectedErrorParameters, $errorObj['parameters']); @@ -438,7 +438,7 @@ public function testSendPasswordResetLinkBadEmailOrWebsite() $this->assertInstanceOf('SoapFault', $e); $this->checkSoapFault( $e, - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', 'env:Sender', $expectedErrorParameters ); @@ -522,7 +522,7 @@ public function testResendConfirmationBadEmailOrWebsite() if (TESTS_WEB_API_ADAPTER == self::ADAPTER_REST) { $errorObj = $this->processRestExceptionResult($e); $this->assertEquals( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', $errorObj['message'] ); $this->assertEquals($expectedErrorParameters, $errorObj['parameters']); @@ -531,7 +531,7 @@ public function testResendConfirmationBadEmailOrWebsite() $this->assertInstanceOf('SoapFault', $e); $this->checkSoapFault( $e, - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', 'env:Sender', $expectedErrorParameters ); diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php index cf2e2fa3b7d71..dcd54099a8cd3 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php @@ -382,7 +382,7 @@ public function testCreateCustomerWithoutAddressRequiresException() $expectedException = new InputException(); $expectedException->addError( __( - InputException::REQUIRED_FIELD, + '%fieldName is a required field.', ['fieldName' => Address::FIRSTNAME] ) ); @@ -397,7 +397,7 @@ public function testCreateCustomerWithoutAddressRequiresException() $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => ['fieldName' => Address::FIRSTNAME], ]; $this->assertEquals($expectedExceptionData, $exceptionData); @@ -504,7 +504,7 @@ public function testSearchCustomersUsingGETEmptyFilter() $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'searchCriteria' ], diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php index a16e7ee59f623..343e69bcc070c 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php @@ -777,7 +777,7 @@ public function testDeleteGroupNotExists() ]; $requestData = [CustomerGroup::ID => $groupId]; - $expectedMessage = NoSuchEntityException::MESSAGE_SINGLE_FIELD; + $expectedMessage = 'No such entity with %fieldName = %fieldValue'; $expectedParameters = ['fieldName' => CustomerGroup::ID, 'fieldValue' => $groupId]; try { diff --git a/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php index 3f0471ba7cee1..8c97fe09552cf 100644 --- a/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php @@ -238,16 +238,16 @@ private function assertInputExceptionMessages($e) $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => InputException::DEFAULT_MESSAGE, + 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'username', ], ], [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'password', ] diff --git a/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php index f04f1472e0f58..09a1792350d83 100644 --- a/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php @@ -161,16 +161,16 @@ private function assertInputExceptionMessages($e) $this->assertEquals(HTTPExceptionCodes::HTTP_BAD_REQUEST, $e->getCode()); $exceptionData = $this->processRestExceptionResult($e); $expectedExceptionData = [ - 'message' => InputException::DEFAULT_MESSAGE, + 'message' => 'One or more input exceptions have occurred.', 'errors' => [ [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'username', ], ], [ - 'message' => InputException::REQUIRED_FIELD, + 'message' => '%fieldName is a required field.', 'parameters' => [ 'fieldName' => 'password', ] diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php index 88d4e559e16d5..277110edf618a 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/BaseService.php @@ -44,7 +44,7 @@ protected function _assertRestUnauthorizedException($serviceInfo, $requestData = $this->_webApiCall($serviceInfo, $requestData); } catch (\Exception $e) { $this->assertContains( - '{"message":"' . AuthorizationException::NOT_AUTHORIZED . '"', + '{"message":"Consumer is not authorized to access %resources"', $e->getMessage(), sprintf( 'REST routing did not fail as expected for the method "%s" of service "%s"', diff --git a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php index 8cd95ef23a47e..c6eef26197762 100644 --- a/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/SoapErrorHandlingTest.php @@ -128,7 +128,7 @@ protected function _testWrappedError($parameters) $expectedException = new \Magento\Framework\Exception\InputException(); foreach ($parameters as $error) { $expectedException->addError( - __(\Magento\Framework\Exception\InputException::INVALID_FIELD_VALUE, $error) + __('Invalid value of "%value" provided for the %fieldName field.', $error) ); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php index b6f9b5eb26c44..36708d683698b 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Api/AddressRepositoryTest.php @@ -201,7 +201,7 @@ public function testSaveNewInvalidAddress() try { $this->repository->save($address); } catch (InputException $exception) { - $this->assertEquals(InputException::DEFAULT_MESSAGE, $exception->getMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $exception->getMessage()); $errors = $exception->getErrors(); $this->assertCount(2, $errors); $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php index 74b0ec843cc94..d92aff9fede64 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagementTest.php @@ -299,7 +299,7 @@ public function testValidateResetPasswordLinkTokenInvalid() $this->accountManagement->validateResetPasswordLinkToken(1, $invalidToken); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage()); + $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); @@ -348,7 +348,7 @@ public function testValidateResetPasswordLinkTokenNull() $this->accountManagement->validateResetPasswordLinkToken(1, null); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage()); + $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); @@ -466,7 +466,7 @@ public function testResetPasswordTokenInvalid() $this->accountManagement->resetPassword('customer@example.com', $invalidToken, $password); $this->fail('Expected exception not thrown.'); } catch (InputException $ie) { - $this->assertEquals(InputException::REQUIRED_FIELD, $ie->getRawMessage()); + $this->assertEquals('%fieldName is a required field.', $ie->getRawMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getMessage()); $this->assertEquals('resetPasswordLinkToken is a required field.', $ie->getLogMessage()); $this->assertEmpty($ie->getErrors()); diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php index b235c358c0d73..54dc7fafb0983 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php @@ -207,7 +207,7 @@ public function testSaveNewInvalidAddress() try { $this->repository->save($address); } catch (InputException $exception) { - $this->assertEquals(InputException::DEFAULT_MESSAGE, $exception->getMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $exception->getMessage()); $errors = $exception->getErrors(); $this->assertCount(2, $errors); $this->assertEquals('firstname is a required field.', $errors[0]->getLogMessage()); diff --git a/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php b/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php index f6e1244e33c0a..85ca4080e7e07 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/Exception/NoSuchEntityExceptionTest.php @@ -18,17 +18,17 @@ public function testConstructor() $exception = new NoSuchEntityException( new Phrase( - NoSuchEntityException::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', ['fieldName' => 'field', 'fieldValue' => 'value'] ) ); $this->assertEquals('No such entity with field = value', $exception->getMessage()); - $this->assertEquals(NoSuchEntityException::MESSAGE_SINGLE_FIELD, $exception->getRawMessage()); + $this->assertEquals('No such entity with %fieldName = %fieldValue', $exception->getRawMessage()); $this->assertEquals('No such entity with field = value', $exception->getLogMessage()); $exception = new NoSuchEntityException( new Phrase( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'field1', 'fieldValue' => 'value1', @@ -38,7 +38,7 @@ public function testConstructor() ) ); $this->assertEquals( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', $exception->getRawMessage() ); $this->assertEquals('No such entity with field1 = value1, field2 = value2', $exception->getMessage()); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php index d34f3d82234a3..988ff1d29ab16 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php @@ -102,7 +102,7 @@ public function validationDataProvider() */ private function assertInputExceptionMessages($e) { - $this->assertEquals(InputException::DEFAULT_MESSAGE, $e->getMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $e->getMessage()); $errors = $e->getErrors(); $this->assertCount(2, $errors); $this->assertEquals('username is a required field.', $errors[0]->getLogMessage()); diff --git a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php index 221d3c27954c1..d6cf0b9f9fc99 100644 --- a/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php @@ -100,7 +100,7 @@ public function validationDataProvider() */ private function assertInputExceptionMessages($e) { - $this->assertEquals(InputException::DEFAULT_MESSAGE, $e->getMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $e->getMessage()); $errors = $e->getErrors(); $this->assertCount(2, $errors); $this->assertEquals('username is a required field.', $errors[0]->getLogMessage()); diff --git a/dev/tests/static/framework/Magento/Sniffs/Translation/ConstantUsageSniff.php b/dev/tests/static/framework/Magento/Sniffs/Translation/ConstantUsageSniff.php new file mode 100644 index 0000000000000..260f731aecf1c --- /dev/null +++ b/dev/tests/static/framework/Magento/Sniffs/Translation/ConstantUsageSniff.php @@ -0,0 +1,46 @@ +previousLineContent) !== 0; + $this->previousLineContent = $lineContent; + $error = 'Constants are not allowed as the first argument of translation function, use string literal instead'; + $constantRegexp = '[^\'"]+::[A-Z_0-9]+.*'; + if ($currentLineMatch) { + $variableRegexp = "~__\({$constantRegexp}\)|Phrase\({$constantRegexp}\)~"; + if (preg_match($variableRegexp, $lineContent) !== 0) { + $phpcsFile->addError($error, $stackPtr, 'VariableTranslation'); + } + } else if ($previousLineMatch) { + $variableRegexp = "~^\s+{$constantRegexp}~"; + if (preg_match($variableRegexp, $lineContent) !== 0) { + $phpcsFile->addError($error, $stackPtr, 'VariableTranslation'); + } + } + } +} diff --git a/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php index bcc3344e2adac..fab29931c04fc 100644 --- a/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php +++ b/lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php @@ -24,6 +24,11 @@ class ExtensionAttributesGenerator extends \Magento\Framework\Code\Generator\Ent */ protected $config; + /** + * @var \Magento\Framework\Reflection\TypeProcessor + */ + private $typeProcessor; + /** * @var array */ @@ -58,6 +63,22 @@ public function __construct( ); } + /** + * Get type processor + * + * @return \Magento\Framework\Reflection\TypeProcessor + * @deprecated + */ + private function getTypeProcessor() + { + if ($this->typeProcessor === null) { + $this->typeProcessor = \Magento\Framework\App\ObjectManager::getInstance()->get( + \Magento\Framework\Reflection\TypeProcessor::class + ); + } + return $this->typeProcessor; + } + /** * {@inheritdoc} */ @@ -90,9 +111,15 @@ protected function _getClassMethods() 'body' => "return \$this->_get('{$attributeName}');", 'docblock' => ['tags' => [['name' => 'return', 'description' => $attributeType . '|null']]], ]; + $parameters = ['name' => $propertyName]; + // If the attribute type is a valid type declaration (e.g., interface, class, array) then use it to enforce + // constraints on the generated setter methods + if ($this->getTypeProcessor()->isValidTypeDeclaration($attributeType)) { + $parameters['type'] = $attributeType; + } $methods[] = [ 'name' => $setterName, - 'parameters' => [['name' => $propertyName]], + 'parameters' => [$parameters], 'body' => "\$this->setData('{$attributeName}', \${$propertyName});" . PHP_EOL . "return \$this;", 'docblock' => [ 'tags' => [ diff --git a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php index 9c68ae66086af..c90e5a68bd165 100644 --- a/lib/internal/Magento/Framework/Api/SortOrderBuilder.php +++ b/lib/internal/Magento/Framework/Api/SortOrderBuilder.php @@ -9,7 +9,7 @@ /** * Builder for sort order data object. - * + * @method SortOrder create() */ class SortOrderBuilder extends AbstractSimpleObjectBuilder { diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php index bfdb3a0a2e8ac..bc7443488db72 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesGeneratorTest.php @@ -15,6 +15,11 @@ class ExtensionAttributesGeneratorTest extends \PHPUnit_Framework_TestCase */ protected $configMock; + /** + * @var \Magento\Framework\Reflection\TypeProcessor|\PHPUnit_Framework_MockObject_MockObject + */ + protected $typeProcessorMock; + /** * @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator|\PHPUnit_Framework_MockObject_MockObject */ @@ -26,11 +31,17 @@ protected function setUp() ->disableOriginalConstructor() ->getMock(); + $this->typeProcessorMock = $this->getMockBuilder('Magento\Framework\Reflection\TypeProcessor') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); + $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); $this->model = $objectManager->getObject( 'Magento\Framework\Api\Code\Generator\ExtensionAttributesGenerator', [ 'config' => $this->configMock, + 'typeProcessor' => $this->typeProcessorMock, 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', 'resultClassName' => '\Magento\Catalog\Api\Data\ProductExtension', 'classGenerator' => null @@ -55,6 +66,11 @@ public function testGenerate() Converter::DATA_TYPE => '\Magento\Bundle\Api\Data\OptionInterface[]', Converter::RESOURCE_PERMISSIONS => [], ], + // Ensure type declaration is added to argument of setter + 'complex_object_attribute_with_type_declaration' => [ + Converter::DATA_TYPE => '\Magento\Bundle\Api\Data\BundleOptionInterface', + Converter::RESOURCE_PERMISSIONS => [], + ], ], 'Magento\Catalog\Api\Data\Product' => [ 'should_not_include' => [ diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php index e01121b13881c..2173304760615 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/ExtensionAttributesInterfaceGeneratorTest.php @@ -29,6 +29,11 @@ public function testGenerate() Converter::DATA_TYPE => '\Magento\Bundle\Api\Data\OptionInterface[]', Converter::RESOURCE_PERMISSIONS => [], ], + // Ensure type declaration is added to argument of setter + 'complex_object_attribute_with_type_declaration' => [ + Converter::DATA_TYPE => '\Magento\Bundle\Api\Data\BundleOptionInterface', + Converter::RESOURCE_PERMISSIONS => [], + ], ], 'Magento\Catalog\Api\Data\Product' => [ 'should_not_include' => [ @@ -38,12 +43,17 @@ public function testGenerate() ], ] ); + $typeProcessorMock = $this->getMockBuilder('Magento\Framework\Reflection\TypeProcessor') + ->disableOriginalConstructor() + ->setMethods(null) + ->getMock(); /** @var \Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator $model */ $model = $objectManager->getObject( 'Magento\Framework\Api\Code\Generator\ExtensionAttributesInterfaceGenerator', [ 'config' => $configMock, + 'typeProcessor' => $typeProcessorMock, 'sourceClassName' => '\Magento\Catalog\Api\Data\Product', 'resultClassName' => '\Magento\Catalog\Api\Data\ProductExtensionInterface', 'classGenerator' => null diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt index 0f9838bd8736c..0e725d453d826 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtension.txt @@ -40,4 +40,22 @@ class ProductExtension extends \Magento\Framework\Api\AbstractSimpleObject imple $this->setData('complex_object_attribute', $complexObjectAttribute); return $this; } + + /** + * @return \Magento\Bundle\Api\Data\BundleOptionInterface|null + */ + public function getComplexObjectAttributeWithTypeDeclaration() + { + return $this->_get('complex_object_attribute_with_type_declaration'); + } + + /** + * @param \Magento\Bundle\Api\Data\BundleOptionInterface $complexObjectAttributeWithTypeDeclaration + * @return $this + */ + public function setComplexObjectAttributeWithTypeDeclaration(\Magento\Bundle\Api\Data\BundleOptionInterface $complexObjectAttributeWithTypeDeclaration) + { + $this->setData('complex_object_attribute_with_type_declaration', $complexObjectAttributeWithTypeDeclaration); + return $this; + } } diff --git a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt index 75dde39b21519..071a141fec3e6 100644 --- a/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt +++ b/lib/internal/Magento/Framework/Api/Test/Unit/Code/Generator/_files/SampleExtensionInterface.txt @@ -26,4 +26,15 @@ interface ProductExtensionInterface extends \Magento\Framework\Api\ExtensionAttr * @return $this */ public function setComplexObjectAttribute($complexObjectAttribute); + + /** + * @return \Magento\Bundle\Api\Data\BundleOptionInterface|null + */ + public function getComplexObjectAttributeWithTypeDeclaration(); + + /** + * @param \Magento\Bundle\Api\Data\BundleOptionInterface $complexObjectAttributeWithTypeDeclaration + * @return $this + */ + public function setComplexObjectAttributeWithTypeDeclaration(\Magento\Bundle\Api\Data\BundleOptionInterface $complexObjectAttributeWithTypeDeclaration); } diff --git a/lib/internal/Magento/Framework/Code/Generator/ClassGenerator.php b/lib/internal/Magento/Framework/Code/Generator/ClassGenerator.php index 3565beaaa792a..02e7a3ff128b2 100644 --- a/lib/internal/Magento/Framework/Code/Generator/ClassGenerator.php +++ b/lib/internal/Magento/Framework/Code/Generator/ClassGenerator.php @@ -85,6 +85,7 @@ protected function _setDataToObject($object, array $data, array $map) public function setClassDocBlock(array $docBlock) { $docBlockObject = new \Zend\Code\Generator\DocBlockGenerator(); + $docBlockObject->setWordWrap(false); $this->_setDataToObject($docBlockObject, $docBlock, $this->_docBlockOptions); return parent::setDocBlock($docBlockObject); @@ -122,6 +123,7 @@ public function addMethods(array $methods) if (isset($methodOptions['docblock']) && is_array($methodOptions['docblock'])) { $docBlockObject = new \Zend\Code\Generator\DocBlockGenerator(); + $docBlockObject->setWordWrap(false); $this->_setDataToObject($docBlockObject, $methodOptions['docblock'], $this->_docBlockOptions); $methodObject->setDocBlock($docBlockObject); @@ -165,6 +167,7 @@ public function addProperties(array $properties) $docBlock = $propertyOptions['docblock']; if (is_array($docBlock)) { $docBlockObject = new \Zend\Code\Generator\DocBlockGenerator(); + $docBlockObject->setWordWrap(false); $this->_setDataToObject($docBlockObject, $docBlock, $this->_docBlockOptions); $propertyObject->setDocBlock($docBlockObject); } diff --git a/lib/internal/Magento/Framework/Exception/AuthenticationException.php b/lib/internal/Magento/Framework/Exception/AuthenticationException.php index 5965011d63b16..e37497ad5b826 100644 --- a/lib/internal/Magento/Framework/Exception/AuthenticationException.php +++ b/lib/internal/Magento/Framework/Exception/AuthenticationException.php @@ -9,5 +9,8 @@ class AuthenticationException extends LocalizedException { + /** + * @deprecated + */ const AUTHENTICATION_ERROR = 'An authentication error occurred.'; } diff --git a/lib/internal/Magento/Framework/Exception/AuthorizationException.php b/lib/internal/Magento/Framework/Exception/AuthorizationException.php index f64b0797a4638..0c260c267cd1b 100644 --- a/lib/internal/Magento/Framework/Exception/AuthorizationException.php +++ b/lib/internal/Magento/Framework/Exception/AuthorizationException.php @@ -9,5 +9,8 @@ class AuthorizationException extends LocalizedException { + /** + * @deprecated + */ const NOT_AUTHORIZED = 'Consumer is not authorized to access %resources'; } diff --git a/lib/internal/Magento/Framework/Exception/ConfigurationMismatchException.php b/lib/internal/Magento/Framework/Exception/ConfigurationMismatchException.php index 58e4f6c6c78cf..c2a654fe50776 100644 --- a/lib/internal/Magento/Framework/Exception/ConfigurationMismatchException.php +++ b/lib/internal/Magento/Framework/Exception/ConfigurationMismatchException.php @@ -11,5 +11,8 @@ */ class ConfigurationMismatchException extends LocalizedException { + /** + * @deprecated + */ const AUTHENTICATION_ERROR = 'Configuration mismatch detected.'; } diff --git a/lib/internal/Magento/Framework/Exception/EmailNotConfirmedException.php b/lib/internal/Magento/Framework/Exception/EmailNotConfirmedException.php index be79edafe606c..f1ab963622797 100644 --- a/lib/internal/Magento/Framework/Exception/EmailNotConfirmedException.php +++ b/lib/internal/Magento/Framework/Exception/EmailNotConfirmedException.php @@ -10,5 +10,8 @@ */ class EmailNotConfirmedException extends AuthenticationException { + /** + * @deprecated + */ const EMAIL_NOT_CONFIRMED = 'Email not confirmed'; } diff --git a/lib/internal/Magento/Framework/Exception/InputException.php b/lib/internal/Magento/Framework/Exception/InputException.php index 26a8e7463ed54..b874329b91d08 100644 --- a/lib/internal/Magento/Framework/Exception/InputException.php +++ b/lib/internal/Magento/Framework/Exception/InputException.php @@ -12,11 +12,34 @@ */ class InputException extends AbstractAggregateException { + /** + * @deprecated + */ const DEFAULT_MESSAGE = 'One or more input exceptions have occurred.'; + + /** + * @deprecated + */ const INVALID_FIELD_RANGE = 'The %fieldName value of "%value" must be between %minValue and %maxValue'; + + /** + * @deprecated + */ const INVALID_FIELD_MIN_VALUE = 'The %fieldName value of "%value" must be greater than or equal to %minValue.'; + + /** + * @deprecated + */ const INVALID_FIELD_MAX_VALUE = 'The %fieldName value of "%value" must be less than or equal to %maxValue.'; + + /** + * @deprecated + */ const INVALID_FIELD_VALUE = 'Invalid value of "%value" provided for the %fieldName field.'; + + /** + * @deprecated + */ const REQUIRED_FIELD = '%fieldName is a required field.'; /** @@ -28,7 +51,7 @@ class InputException extends AbstractAggregateException public function __construct(Phrase $phrase = null, \Exception $cause = null) { if ($phrase === null) { - $phrase = new Phrase(self::DEFAULT_MESSAGE); + $phrase = new Phrase('One or more input exceptions have occurred.'); } parent::__construct($phrase, $cause); } @@ -44,7 +67,7 @@ public function __construct(Phrase $phrase = null, \Exception $cause = null) public static function invalidFieldValue($fieldName, $fieldValue, \Exception $cause = null) { return new self( - new Phrase(self::INVALID_FIELD_VALUE, ['fieldName' => $fieldName, 'value' => $fieldValue]), + new Phrase('Invalid value of "%value" provided for the %fieldName field.', ['fieldName' => $fieldName, 'value' => $fieldValue]), $cause ); } @@ -58,7 +81,7 @@ public static function invalidFieldValue($fieldName, $fieldValue, \Exception $ca public static function requiredField($fieldName) { return new self( - new Phrase(self::REQUIRED_FIELD, ['fieldName' => $fieldName]) + new Phrase('%fieldName is a required field.', ['fieldName' => $fieldName]) ); } } diff --git a/lib/internal/Magento/Framework/Exception/InvalidEmailOrPasswordException.php b/lib/internal/Magento/Framework/Exception/InvalidEmailOrPasswordException.php index 697146e8142d0..e043976b7ffa3 100644 --- a/lib/internal/Magento/Framework/Exception/InvalidEmailOrPasswordException.php +++ b/lib/internal/Magento/Framework/Exception/InvalidEmailOrPasswordException.php @@ -10,5 +10,8 @@ */ class InvalidEmailOrPasswordException extends AuthenticationException { + /** + * @deprecated + */ const INVALID_EMAIL_OR_PASSWORD = 'Invalid email or password'; } diff --git a/lib/internal/Magento/Framework/Exception/NoSuchEntityException.php b/lib/internal/Magento/Framework/Exception/NoSuchEntityException.php index c1bbbaa7a357e..360b98e315d3e 100644 --- a/lib/internal/Magento/Framework/Exception/NoSuchEntityException.php +++ b/lib/internal/Magento/Framework/Exception/NoSuchEntityException.php @@ -11,7 +11,14 @@ class NoSuchEntityException extends LocalizedException { + /** + * @deprecated + */ const MESSAGE_SINGLE_FIELD = 'No such entity with %fieldName = %fieldValue'; + + /** + * @deprecated + */ const MESSAGE_DOUBLE_FIELDS = 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value'; /** @@ -37,7 +44,7 @@ public static function singleField($fieldName, $fieldValue) { return new self( new Phrase( - self::MESSAGE_SINGLE_FIELD, + 'No such entity with %fieldName = %fieldValue', [ 'fieldName' => $fieldName, 'fieldValue' => $fieldValue @@ -59,7 +66,7 @@ public static function doubleField($fieldName, $fieldValue, $secondFieldName, $s { return new self( new Phrase( - self::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => $fieldName, 'fieldValue' => $fieldValue, diff --git a/lib/internal/Magento/Framework/Exception/SerializationException.php b/lib/internal/Magento/Framework/Exception/SerializationException.php index 9686b3930bb0f..109f8c5bb0fa9 100644 --- a/lib/internal/Magento/Framework/Exception/SerializationException.php +++ b/lib/internal/Magento/Framework/Exception/SerializationException.php @@ -12,7 +12,14 @@ */ class SerializationException extends LocalizedException { + /** + * @deprecated + */ const DEFAULT_MESSAGE = 'Invalid type'; + + /** + * @deprecated + */ const TYPE_MISMATCH = 'Invalid type for value: "%value". Expected Type: "%type".'; /** @@ -22,7 +29,7 @@ class SerializationException extends LocalizedException public function __construct(Phrase $phrase = null, \Exception $cause = null) { if ($phrase === null) { - $phrase = new Phrase(self::DEFAULT_MESSAGE); + $phrase = new Phrase('One or more input exceptions have occurred.'); } parent::__construct($phrase, $cause); } diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php index 7f14a916db02e..68615f2d41858 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthenticationExceptionTest.php @@ -11,8 +11,6 @@ /** * Class AuthenticationExceptionTest - * - * @package Magento\Framework\Exception */ class AuthenticationExceptionTest extends \PHPUnit_Framework_TestCase { @@ -23,7 +21,7 @@ public function testConstructor() { $authenticationException = new AuthenticationException( new Phrase( - AuthenticationException::AUTHENTICATION_ERROR, + 'An authentication error occurred.', ['consumer_id' => 1, 'resources' => 'record2'] ) ); diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php index c425641671a86..1315a4fa53884 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/AuthorizationExceptionTest.php @@ -17,7 +17,7 @@ public function testConstructor() { $authorizationException = new AuthorizationException( new Phrase( - AuthorizationException::NOT_AUTHORIZED, + 'Consumer is not authorized to access %resources', ['consumer_id' => 1, 'resources' => 'record2'] ) ); diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/EmailNotConfirmedExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/EmailNotConfirmedExceptionTest.php index b07cbd81cd4ba..9a0ccdac0ede5 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/EmailNotConfirmedExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/EmailNotConfirmedExceptionTest.php @@ -11,8 +11,6 @@ /** * Class EmailNotConfirmedExceptionTest - * - * @package Magento\Framework\Exception */ class EmailNotConfirmedExceptionTest extends \PHPUnit_Framework_TestCase { @@ -23,7 +21,7 @@ public function testConstructor() { $emailNotConfirmedException = new EmailNotConfirmedException( new Phrase( - EmailNotConfirmedException::EMAIL_NOT_CONFIRMED, + 'Email not confirmed', ['consumer_id' => 1, 'resources' => 'record2'] ) ); diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php index b35f65c4fad94..cc0f4a2f0b5c3 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/InputExceptionTest.php @@ -20,10 +20,13 @@ public function testConstructor() { $params = ['fieldName' => 'quantity', 'value' => -100, 'minValue' => 0]; $inputException = new InputException( - new Phrase(InputException::INVALID_FIELD_MIN_VALUE, $params) + new Phrase('The %fieldName value of "%value" must be greater than or equal to %minValue.', $params) ); - $this->assertEquals(InputException::INVALID_FIELD_MIN_VALUE, $inputException->getRawMessage()); + $this->assertEquals( + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', + $inputException->getRawMessage() + ); $this->assertStringMatchesFormat('%s greater than or equal to %s', $inputException->getMessage()); $this->assertEquals( 'The quantity value of "-100" must be greater than or equal to 0.', @@ -40,26 +43,29 @@ public function testAddError() { $inputException = new InputException(); - $this->assertEquals(InputException::DEFAULT_MESSAGE, $inputException->getRawMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $inputException->getRawMessage()); $this->assertEquals( - InputException::DEFAULT_MESSAGE, + 'One or more input exceptions have occurred.', $inputException->getMessage() ); - $this->assertEquals(InputException::DEFAULT_MESSAGE, $inputException->getLogMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $inputException->getLogMessage()); $this->assertFalse($inputException->wasErrorAdded()); $this->assertCount(0, $inputException->getErrors()); $inputException->addError( new Phrase( - InputException::INVALID_FIELD_MIN_VALUE, + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', ['fieldName' => 'weight', 'value' => -100, 'minValue' => 1] ) ); $this->assertTrue($inputException->wasErrorAdded()); $this->assertCount(0, $inputException->getErrors()); - $this->assertEquals(InputException::INVALID_FIELD_MIN_VALUE, $inputException->getRawMessage()); + $this->assertEquals( + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', + $inputException->getRawMessage() + ); $this->assertEquals( 'The weight value of "-100" must be greater than or equal to 1.', $inputException->getMessage() @@ -69,21 +75,24 @@ public function testAddError() $inputException->getLogMessage() ); - $inputException->addError(new Phrase(InputException::REQUIRED_FIELD, ['fieldName' => 'name'])); + $inputException->addError(new Phrase('%fieldName is a required field.', ['fieldName' => 'name'])); $this->assertTrue($inputException->wasErrorAdded()); $this->assertCount(2, $inputException->getErrors()); - $this->assertEquals(InputException::DEFAULT_MESSAGE, $inputException->getRawMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $inputException->getRawMessage()); $this->assertEquals( - InputException::DEFAULT_MESSAGE, + 'One or more input exceptions have occurred.', $inputException->getMessage() ); - $this->assertEquals(InputException::DEFAULT_MESSAGE, $inputException->getLogMessage()); + $this->assertEquals('One or more input exceptions have occurred.', $inputException->getLogMessage()); $errors = $inputException->getErrors(); $this->assertCount(2, $errors); - $this->assertEquals(InputException::INVALID_FIELD_MIN_VALUE, $errors[0]->getRawMessage()); + $this->assertEquals( + 'The %fieldName value of "%value" must be greater than or equal to %minValue.', + $errors[0]->getRawMessage() + ); $this->assertEquals( 'The weight value of "-100" must be greater than or equal to 1.', $errors[0]->getMessage() @@ -93,7 +102,7 @@ public function testAddError() $errors[0]->getLogMessage() ); - $this->assertEquals(InputException::REQUIRED_FIELD, $errors[1]->getRawMessage()); + $this->assertEquals('%fieldName is a required field.', $errors[1]->getRawMessage()); $this->assertEquals('name is a required field.', $errors[1]->getMessage()); $this->assertEquals('name is a required field.', $errors[1]->getLogMessage()); } diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/InvalidEmailOrPasswordExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/InvalidEmailOrPasswordExceptionTest.php deleted file mode 100644 index 0fc9fde4b0cab..0000000000000 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/InvalidEmailOrPasswordExceptionTest.php +++ /dev/null @@ -1,32 +0,0 @@ - 1, 'resources' => 'record2'] - ) - ); - $this->assertSame('Invalid email or password', $exception->getMessage()); - } -} diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/NoSuchEntityExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/NoSuchEntityExceptionTest.php index 711045beaf8d8..a75f8c67f53f9 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/NoSuchEntityExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/NoSuchEntityExceptionTest.php @@ -75,46 +75,6 @@ public function testConstructor() $this->assertSame($cause, $localizeException->getPrevious()); } - /** - * @param string $message - * @param string $expectedMessage - * @return void - * @dataProvider constantsDataProvider - */ - public function testConstants($message, $expectedMessage) - { - $this->renderedMessage = $message; - $this->rendererMock->expects($this->once()) - ->method('render') - ->will($this->returnValue($this->renderedMessage)); - \Magento\Framework\Phrase::setRenderer($this->rendererMock); - - $exception = new NoSuchEntityException( - new Phrase( - $message, - ['consumer_id' => 1, 'resources' => 'record2'] - ) - ); - $this->assertSame($expectedMessage, $exception->getMessage()); - } - - /** - * @return array - */ - public function constantsDataProvider() - { - return [ - 'singleFields' => [ - NoSuchEntityException::MESSAGE_SINGLE_FIELD, - 'No such entity with %fieldName = %fieldValue', - ], - 'doubleFields' => [ - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, - 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', - ] - ]; - } - /** * @return void */ diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/State/ExpiredExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/State/ExpiredExceptionTest.php index 2afd426c72d90..6ac82feb18a51 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/State/ExpiredExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/State/ExpiredExceptionTest.php @@ -12,8 +12,6 @@ /** * Class ExpiredException - * - * @package Magento\Framework\Exception\State */ class ExpiredExceptionTest extends \PHPUnit_Framework_TestCase { diff --git a/lib/internal/Magento/Framework/Exception/Test/Unit/StateExceptionTest.php b/lib/internal/Magento/Framework/Exception/Test/Unit/StateExceptionTest.php index 7cb66c6b57e80..76f903acf6032 100644 --- a/lib/internal/Magento/Framework/Exception/Test/Unit/StateExceptionTest.php +++ b/lib/internal/Magento/Framework/Exception/Test/Unit/StateExceptionTest.php @@ -11,8 +11,6 @@ /** * Class StateExceptionTest - * - * @package Magento\Framework\Exception */ class StateExceptionTest extends \PHPUnit_Framework_TestCase { diff --git a/lib/internal/Magento/Framework/Oauth/Helper/Request.php b/lib/internal/Magento/Framework/Oauth/Helper/Request.php index c9932a9fee2b9..6ac16f555c5b8 100644 --- a/lib/internal/Magento/Framework/Oauth/Helper/Request.php +++ b/lib/internal/Magento/Framework/Oauth/Helper/Request.php @@ -200,7 +200,7 @@ public function prepareErrorResponse( $responseCode = self::HTTP_UNAUTHORIZED; } elseif ($exception instanceof \Magento\Framework\Oauth\OauthInputException) { $responseCode = self::HTTP_BAD_REQUEST; - if ($errorMsg == \Magento\Framework\Oauth\OauthInputException::DEFAULT_MESSAGE) { + if ($errorMsg == 'One or more input exceptions have occurred.') { $errorMsg = $exception->getAggregatedErrorMessage(); } } else { diff --git a/lib/internal/Magento/Framework/Oauth/Oauth.php b/lib/internal/Magento/Framework/Oauth/Oauth.php index d77ccdf856bd4..705ff7883a3d9 100644 --- a/lib/internal/Magento/Framework/Oauth/Oauth.php +++ b/lib/internal/Magento/Framework/Oauth/Oauth.php @@ -284,7 +284,7 @@ protected function _checkRequiredParams($protocolParams, $requiredParams) $exception = new OauthInputException(); foreach ($requiredParams as $param) { if (!isset($protocolParams[$param])) { - $exception->addError(new Phrase(OauthInputException::REQUIRED_FIELD, ['fieldName' => $param])); + $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $param])); } } if ($exception->wasErrorAdded()) { diff --git a/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php b/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php index 58762208a0bc6..b8b503fb87c0c 100644 --- a/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php +++ b/lib/internal/Magento/Framework/Oauth/Test/Unit/OauthInputExceptionTest.php @@ -17,7 +17,7 @@ public function testGetAggregatedErrorMessage() { $exception = new OauthInputException(); foreach (['field1', 'field2'] as $param) { - $exception->addError(new Phrase(OauthInputException::REQUIRED_FIELD, ['fieldName' => $param])); + $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $param])); } $exception->addError(new Phrase('Message with period.')); diff --git a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt index 803d9828cf54d..b56cf46027540 100644 --- a/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt +++ b/lib/internal/Magento/Framework/ObjectManager/Test/Unit/Code/Generator/_files/SampleRepository.txt @@ -1,8 +1,7 @@ namespace Magento\Framework\ObjectManager\Code\Generator; /** - * Repository class for @see - * \Magento\Framework\ObjectManager\Code\Generator\SampleInterface + * Repository class for @see \Magento\Framework\ObjectManager\Code\Generator\SampleInterface */ class SampleRepository implements \Magento\Framework\ObjectManager\Code\Generator\SampleRepositoryInterface { @@ -16,8 +15,7 @@ class SampleRepository implements \Magento\Framework\ObjectManager\Code\Generato /** * Collection Factory * - * @var - * \Magento\Framework\ObjectManager\Code\Generator\SampleSearchResultInterfaceFactory + * @var \Magento\Framework\ObjectManager\Code\Generator\SampleSearchResultInterfaceFactory */ protected $sampleInterfaceSearchResultFactory = null; @@ -40,13 +38,9 @@ class SampleRepository implements \Magento\Framework\ObjectManager\Code\Generato /** * Repository constructor * - * @param \Magento\Framework\ObjectManager\Code\Generator\SampleInterface - * $sampleInterfacePersistor - * @param - * \Magento\Framework\ObjectManager\Code\Generator\SampleSearchResultInterfaceFactory - * $sampleInterfaceSearchResultFactory - * @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface - * $extensionAttributesJoinProcessor + * @param \Magento\Framework\ObjectManager\Code\Generator\SampleInterface $sampleInterfacePersistor + * @param \Magento\Framework\ObjectManager\Code\Generator\SampleSearchResultInterfaceFactory $sampleInterfaceSearchResultFactory + * @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor */ public function __construct(\Magento\Framework\ObjectManager\Code\Generator\SampleInterfacePersistor $sampleInterfacePersistor, \Magento\Framework\ObjectManager\Code\Generator\SampleSearchResultInterfaceFactory $sampleInterfaceSearchResultFactory, \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor) { diff --git a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php index 4f65e318e3ba8..c2c3a041f9319 100644 --- a/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php +++ b/lib/internal/Magento/Framework/Reflection/Test/Unit/TypeProcessorTest.php @@ -116,6 +116,26 @@ public function testIsArrayType() $this->assertTrue($this->_typeProcessor->isArrayType('string[]')); } + public function testIsValidTypeDeclaration() + { + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('Traversable')); // Interface + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('stdObj')); // Class + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('array')); + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('callable')); + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('self')); + $this->assertTrue($this->_typeProcessor->isValidTypeDeclaration('self')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('string')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('string[]')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('int')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('float')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('double')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('boolean')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('[]')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('mixed[]')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('stdObj[]')); + $this->assertFalse($this->_typeProcessor->isValidTypeDeclaration('Traversable[]')); + } + public function getArrayItemType() { $this->assertEquals('string', $this->_typeProcessor->getArrayItemType('str[]')); diff --git a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php index ba56f8942e0e1..234b230afb623 100644 --- a/lib/internal/Magento/Framework/Reflection/TypeProcessor.php +++ b/lib/internal/Magento/Framework/Reflection/TypeProcessor.php @@ -420,6 +420,18 @@ public function isArrayType($type) return (bool)preg_match('/(\[\]$|^ArrayOf)/', $type); } + /** + * Check if given type is valid to use as an argument type declaration + * + * @see http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration + * @param string $type + * @return bool + */ + public function isValidTypeDeclaration($type) + { + return !($this->isTypeSimple($type) || $this->isTypeAny($type) || $this->isArrayType($type)); + } + /** * Get item type of the array. * @@ -491,7 +503,7 @@ public function processSimpleAndAnyType($value, $type) if ($value !== null && !settype($value[$key], $arrayItemType)) { throw new SerializationException( new Phrase( - SerializationException::TYPE_MISMATCH, + 'Invalid type for value: "%value". Expected Type: "%type".', ['value' => $value, 'type' => $type] ) ); @@ -503,7 +515,7 @@ public function processSimpleAndAnyType($value, $type) if ($value !== null && $type !== self::ANY_TYPE && !$this->setType($value, $type)) { throw new SerializationException( new Phrase( - SerializationException::TYPE_MISMATCH, + 'Invalid type for value: "%value". Expected Type: "%type".', ['value' => (string)$value, 'type' => $type] ) ); @@ -511,7 +523,7 @@ public function processSimpleAndAnyType($value, $type) } else { throw new SerializationException( new Phrase( - SerializationException::TYPE_MISMATCH, + 'Invalid type for value: "%value". Expected Type: "%type".', ['value' => gettype($value), 'type' => $type] ) ); diff --git a/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php b/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php index 7dc84bda14563..4f7f73871ebe8 100644 --- a/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php +++ b/lib/internal/Magento/Framework/TestFramework/Unit/Helper/ObjectManager.php @@ -162,13 +162,17 @@ public function getObject($className, array $arguments = []) $newObject = $reflectionClass->newInstanceArgs($constructArguments); foreach (array_diff_key($arguments, $constructArguments) as $key => $value) { - if ($reflectionClass->hasProperty($key)) { - $reflectionProperty = $reflectionClass->getProperty($key); - $reflectionProperty->setAccessible(true); - $reflectionProperty->setValue($newObject, $value); + $propertyReflectionClass = $reflectionClass; + while ($propertyReflectionClass) { + if ($propertyReflectionClass->hasProperty($key)) { + $reflectionProperty = $propertyReflectionClass->getProperty($key); + $reflectionProperty->setAccessible(true); + $reflectionProperty->setValue($newObject, $value); + break; + } + $propertyReflectionClass = $propertyReflectionClass->getParentClass(); } } - return $newObject; } diff --git a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php index 47052ad62de4d..646f432578757 100644 --- a/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php +++ b/lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php @@ -312,7 +312,7 @@ protected function processInputError($inputError) if (!empty($inputError)) { $exception = new InputException(); foreach ($inputError as $errorParamField) { - $exception->addError(new Phrase(InputException::REQUIRED_FIELD, ['fieldName' => $errorParamField])); + $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $errorParamField])); } if ($exception->wasErrorAdded()) { throw $exception; diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ErrorProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ErrorProcessorTest.php index 0fb6cc8db21da..481df15b3e074 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ErrorProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ErrorProcessorTest.php @@ -253,7 +253,7 @@ public function dataProviderForSendResponseExceptions() 'NoSuchEntityException' => [ new NoSuchEntityException( new Phrase( - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'detail1', 'fieldValue' => 'value1', @@ -263,7 +263,7 @@ public function dataProviderForSendResponseExceptions() ) ), \Magento\Framework\Webapi\Exception::HTTP_NOT_FOUND, - NoSuchEntityException::MESSAGE_DOUBLE_FIELDS, + 'No such entity with %fieldName = %fieldValue, %field2Name = %field2Value', [ 'fieldName' => 'detail1', 'fieldValue' => 'value1', @@ -280,12 +280,12 @@ public function dataProviderForSendResponseExceptions() 'AuthorizationException' => [ new AuthorizationException( new Phrase( - AuthorizationException::NOT_AUTHORIZED, + 'Consumer %consumer_id is not authorized to access %resources', ['consumer_id' => '3', 'resources' => '4'] ) ), WebapiException::HTTP_UNAUTHORIZED, - AuthorizationException::NOT_AUTHORIZED, + 'Consumer %consumer_id is not authorized to access %resources', ['consumer_id' => '3', 'resources' => '4'], ], 'Exception' => [ diff --git a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php index 6e592647e4b4e..3a308a3dce5f7 100644 --- a/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php +++ b/lib/internal/Magento/Framework/Webapi/Test/Unit/ServiceInputProcessorTest.php @@ -133,7 +133,7 @@ public function testNonExistentPropertiesWithDefaultArgumentValue() /** * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage \Magento\Framework\Exception\InputException::DEFAULT_MESSAGE + * @expectedExceptionMessage One or more input exceptions have occurred. */ public function testNonExistentPropertiesWithoutDefaultArgumentValue() {