diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml
index 7bdba49d64e22..9a12250d270d2 100644
--- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml
+++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/viewmode.phtml
@@ -10,7 +10,7 @@
*
* @var $this \Magento\Catalog\Block\Product\ProductList\Toolbar
*/
-use \Magento\Catalog\Model\Product\ProductList\Toolbar;
+use Magento\Catalog\Model\Product\ProductList\Toolbar;
?>
isEnabledViewSwitcher()): ?>
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
index 0d9f04cb97895..9d0870370b967 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
@@ -7,7 +7,7 @@
use Magento\Catalog\Model\Category;
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
-use \Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider;
+use Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider;
class Move
{
diff --git a/app/code/Magento/Checkout/Service/V1/PaymentMethod/ReadService.php b/app/code/Magento/Checkout/Service/V1/PaymentMethod/ReadService.php
index fc9d85badb8a4..d954a611af223 100644
--- a/app/code/Magento/Checkout/Service/V1/PaymentMethod/ReadService.php
+++ b/app/code/Magento/Checkout/Service/V1/PaymentMethod/ReadService.php
@@ -5,11 +5,10 @@
*/
namespace Magento\Checkout\Service\V1\PaymentMethod;
-use \Magento\Sales\Model\QuoteRepository;
-use \Magento\Store\Model\StoreManagerInterface;
+use Magento\Sales\Model\QuoteRepository;
use Magento\Checkout\Service\V1\Data\Cart\PaymentMethod\Converter as QuoteMethodConverter;
use Magento\Checkout\Service\V1\Data\PaymentMethod\Converter as PaymentMethodConverter;
-use \Magento\Payment\Model\MethodList;
+use Magento\Payment\Model\MethodList;
/**
* Payment method read service object.
diff --git a/app/code/Magento/Checkout/etc/webapi.xml b/app/code/Magento/Checkout/etc/webapi.xml
index cd264a295231a..786e9bb82884a 100644
--- a/app/code/Magento/Checkout/etc/webapi.xml
+++ b/app/code/Magento/Checkout/etc/webapi.xml
@@ -55,7 +55,7 @@
-
+
diff --git a/app/code/Magento/CheckoutAgreements/Service/V1/Agreement/ReadService.php b/app/code/Magento/CheckoutAgreements/Service/V1/Agreement/ReadService.php
index 9dec4550693c3..ff5684b6c4537 100644
--- a/app/code/Magento/CheckoutAgreements/Service/V1/Agreement/ReadService.php
+++ b/app/code/Magento/CheckoutAgreements/Service/V1/Agreement/ReadService.php
@@ -5,14 +5,14 @@
*/
namespace Magento\CheckoutAgreements\Service\V1\Agreement;
-use \Magento\CheckoutAgreements\Model\Resource\Agreement\CollectionFactory as AgreementCollectionFactory;
-use \Magento\CheckoutAgreements\Model\Resource\Agreement\Collection as AgreementCollection;
-use \Magento\CheckoutAgreements\Model\Agreement;
-use \Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\CheckoutAgreements\Model\Resource\Agreement\CollectionFactory as AgreementCollectionFactory;
+use Magento\CheckoutAgreements\Model\Resource\Agreement\Collection as AgreementCollection;
+use Magento\CheckoutAgreements\Model\Agreement;
+use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Store\Model\StoreManagerInterface;
-use \Magento\Store\Model\ScopeInterface;
-use \Magento\CheckoutAgreements\Service\V1\Data\AgreementBuilder;
-use \Magento\CheckoutAgreements\Service\V1\Data\Agreement as AgreementDataObject;
+use Magento\Store\Model\ScopeInterface;
+use Magento\CheckoutAgreements\Service\V1\Data\AgreementBuilder;
+use Magento\CheckoutAgreements\Service\V1\Data\Agreement as AgreementDataObject;
/**
* Checkout agreement service.
diff --git a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php
index a00dca8d81dc6..adb3c2b9bd413 100644
--- a/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php
+++ b/app/code/Magento/ConfigurableProduct/Model/OptionRepository.php
@@ -6,14 +6,14 @@
*/
namespace Magento\ConfigurableProduct\Model;
-use \Magento\Framework\Exception\NoSuchEntityException;
-use \Magento\Webapi\Exception;
-use \Magento\Framework\Exception\StateException;
-use \Magento\Framework\Exception\InputException;
-use \Magento\Framework\Exception\CouldNotSaveException;
-use \Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
-use \Magento\Catalog\Model\Product\Type as ProductType;
-use \Magento\Store\Model\Store;
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Webapi\Exception;
+use Magento\Framework\Exception\StateException;
+use Magento\Framework\Exception\InputException;
+use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable as ConfigurableType;
+use Magento\Catalog\Model\Product\Type as ProductType;
+use Magento\Store\Model\Store;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
index b712323e706f5..c4512eff45304 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/super/config.phtml
@@ -5,7 +5,7 @@
*/
/** @var $this \Magento\ConfigurableProduct\Block\Adminhtml\Product\Edit\Tab\Super\Config */
-use \Magento\ConfigurableProduct\Model\Product\Type\Configurable;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
?>
diff --git a/app/code/Magento/Customer/Model/GroupManagement.php b/app/code/Magento/Customer/Model/GroupManagement.php
index d26716e059aee..52d557faaa858 100644
--- a/app/code/Magento/Customer/Model/GroupManagement.php
+++ b/app/code/Magento/Customer/Model/GroupManagement.php
@@ -10,7 +10,7 @@
use Magento\Customer\Api\Data\GroupInterface;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Framework\App\Config\ScopeConfigInterface;
-use \Magento\Framework\Api\FilterBuilder;
+use Magento\Framework\Api\FilterBuilder;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Customer\Api\GroupRepositoryInterface;
diff --git a/app/code/Magento/Customer/etc/webapi.xml b/app/code/Magento/Customer/etc/webapi.xml
index ff070071d1cf8..c5a78103007bd 100644
--- a/app/code/Magento/Customer/etc/webapi.xml
+++ b/app/code/Magento/Customer/etc/webapi.xml
@@ -32,12 +32,6 @@
-
-
-
-
-
-
@@ -161,12 +155,6 @@
%customer_id%
-
-
-
-
-
-
diff --git a/app/code/Magento/Eav/etc/webapi.xml b/app/code/Magento/Eav/etc/webapi.xml
index 655fe1992f8ea..ca246c7cf3a97 100644
--- a/app/code/Magento/Eav/etc/webapi.xml
+++ b/app/code/Magento/Eav/etc/webapi.xml
@@ -7,7 +7,7 @@
-->
-
+
diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php
index 0c6a99b655721..8b2c170fbec78 100644
--- a/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php
+++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration/Save.php
@@ -30,7 +30,6 @@ protected function _redirectOnSaveError()
* Save integration action.
*
* @return void
- * @todo: Fix cyclomatic complexity.
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function execute()
@@ -56,7 +55,6 @@ public function execute()
/** @var array $data */
$data = $this->getRequest()->getPost();
if (!empty($data)) {
- // TODO: Move out work with API permissions to Web API module
if (!isset($data['resource'])) {
$integrationData['resource'] = [];
}
diff --git a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php
index 5d9137f6c162e..81a6b538fd912 100644
--- a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php
+++ b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php
@@ -22,16 +22,24 @@ class Provider implements TokenProviderInterface
*/
protected $_tokenFactory;
+ /**
+ * @var \Psr\Log\LoggerInterface
+ */
+ protected $logger;
+
/**
* @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory
* @param \Magento\Integration\Model\Oauth\TokenFactory $tokenFactory
+ * @param \Psr\Log\LoggerInterface $logger
*/
public function __construct(
\Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory,
- \Magento\Integration\Model\Oauth\TokenFactory $tokenFactory
+ \Magento\Integration\Model\Oauth\TokenFactory $tokenFactory,
+ \Psr\Log\LoggerInterface $logger
) {
$this->_consumerFactory = $consumerFactory;
$this->_tokenFactory = $tokenFactory;
+ $this->logger = $logger;
}
/**
@@ -94,14 +102,17 @@ public function validateRequestToken($requestToken, $consumer, $oauthVerifier)
*/
public function getAccessToken($consumer)
{
- /** TODO: log the request token in dev mode since its not persisted. */
- $token = $this->getIntegrationTokenByConsumerId($consumer->getId());
+ $consumerId = $consumer->getId();
+ $token = $this->getIntegrationTokenByConsumerId($consumerId);
if (Token::TYPE_REQUEST != $token->getType()) {
throw new \Magento\Framework\Oauth\Exception(
'Cannot get access token because consumer token is not a request token'
);
}
$accessToken = $token->convertToAccess();
+ $this->logger->info(
+ 'Request token ' . $token->getToken() . ' was exchanged to obtain access token for consumer ' . $consumerId
+ );
return ['oauth_token' => $accessToken->getToken(), 'oauth_token_secret' => $accessToken->getSecret()];
}
diff --git a/app/code/Magento/Integration/Service/V1/Integration.php b/app/code/Magento/Integration/Service/V1/Integration.php
index edcd2dec701aa..e48d764d0784c 100644
--- a/app/code/Magento/Integration/Service/V1/Integration.php
+++ b/app/code/Magento/Integration/Service/V1/Integration.php
@@ -45,7 +45,6 @@ public function create(array $integrationData)
{
$this->_checkIntegrationByName($integrationData['name']);
$integration = $this->_integrationFactory->create($integrationData);
- // TODO: Think about double save issue
$integration->save();
$consumerName = 'Integration' . $integration->getId();
$consumer = $this->_oauthService->createConsumer(['name' => $consumerName]);
diff --git a/app/code/Magento/Integration/Service/V1/Oauth.php b/app/code/Magento/Integration/Service/V1/Oauth.php
index 292f469001970..5816700e8eb7d 100644
--- a/app/code/Magento/Integration/Service/V1/Oauth.php
+++ b/app/code/Magento/Integration/Service/V1/Oauth.php
@@ -16,7 +16,6 @@
/**
* Integration oAuth service.
*
- * TODO: Fix coupling between objects
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Oauth implements OauthInterface
diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php
index a7ef281588712..f90b089bfdead 100644
--- a/app/code/Magento/ProductAlert/Model/Email.php
+++ b/app/code/Magento/ProductAlert/Model/Email.php
@@ -299,7 +299,11 @@ public function send()
return false;
}
- $store = $this->_website->getDefaultStore();
+ if ($this->_customer->getStoreId() > 0) {
+ $store = $this->_storeManager->getStore($this->_customer->getStoreId());
+ } else {
+ $store = $this->_website->getDefaultStore();
+ }
$storeId = $store->getId();
if ($this->_type == 'price' && !$this->_scopeConfig->getValue(
diff --git a/app/code/Magento/Sales/Model/Quote/Item/Processor.php b/app/code/Magento/Sales/Model/Quote/Item/Processor.php
index b8d772da60e30..ddff79cb2e43f 100644
--- a/app/code/Magento/Sales/Model/Quote/Item/Processor.php
+++ b/app/code/Magento/Sales/Model/Quote/Item/Processor.php
@@ -5,12 +5,12 @@
*/
namespace Magento\Sales\Model\Quote\Item;
-use \Magento\Catalog\Model\Product;
-use \Magento\Sales\Model\Quote\ItemFactory;
-use \Magento\Sales\Model\Quote\Item;
+use Magento\Catalog\Model\Product;
+use Magento\Sales\Model\Quote\ItemFactory;
+use Magento\Sales\Model\Quote\Item;
use Magento\Store\Model\StoreManagerInterface;
-use \Magento\Framework\App\State;
-use \Magento\Framework\Object;
+use Magento\Framework\App\State;
+use Magento\Framework\Object;
/**
* Class Processor
diff --git a/app/code/Magento/Sales/Model/QuoteRepository.php b/app/code/Magento/Sales/Model/QuoteRepository.php
index 4d2a6937304f8..087559542fc7d 100644
--- a/app/code/Magento/Sales/Model/QuoteRepository.php
+++ b/app/code/Magento/Sales/Model/QuoteRepository.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Sales\Model;
-use \Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Store\Model\StoreManagerInterface;
class QuoteRepository
diff --git a/app/code/Magento/Sales/etc/webapi.xml b/app/code/Magento/Sales/etc/webapi.xml
index 95d2e2fc1fb03..bfa2d724e25a4 100644
--- a/app/code/Magento/Sales/etc/webapi.xml
+++ b/app/code/Magento/Sales/etc/webapi.xml
@@ -13,7 +13,7 @@
-
+
@@ -79,7 +79,7 @@
-
+
@@ -127,7 +127,7 @@
-
+
@@ -169,7 +169,7 @@
-
+
@@ -229,7 +229,7 @@
-
+
diff --git a/app/code/Magento/Tax/etc/webapi.xml b/app/code/Magento/Tax/etc/webapi.xml
index e131f4fb5b38d..554f6729785b7 100644
--- a/app/code/Magento/Tax/etc/webapi.xml
+++ b/app/code/Magento/Tax/etc/webapi.xml
@@ -31,7 +31,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
@@ -91,7 +91,7 @@
-
+
diff --git a/app/code/Magento/Webapi/Controller/Rest/Response/Renderer/Factory.php b/app/code/Magento/Webapi/Controller/Rest/Response/Renderer/Factory.php
index 16b1afdf9bca1..e358f8c152fb1 100644
--- a/app/code/Magento/Webapi/Controller/Rest/Response/Renderer/Factory.php
+++ b/app/code/Magento/Webapi/Controller/Rest/Response/Renderer/Factory.php
@@ -80,7 +80,11 @@ protected function _getRendererClass()
}
/** If server does not have renderer for any of the accepted types it SHOULD send 406 (not acceptable). */
throw new \Magento\Webapi\Exception(
- __('Server cannot understand Accept HTTP header media type.'),
+ __(
+ 'Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1" '.
+ 'with media types from the config of response renderer.',
+ implode(',', $acceptTypes)
+ ),
0,
\Magento\Webapi\Exception::HTTP_NOT_ACCEPTABLE
);
diff --git a/app/code/Magento/Webapi/i18n/de_DE.csv b/app/code/Magento/Webapi/i18n/de_DE.csv
index 38d04492b4c50..ab5001bdee4ac 100644
--- a/app/code/Magento/Webapi/i18n/de_DE.csv
+++ b/app/code/Magento/Webapi/i18n/de_DE.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.","Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/en_US.csv b/app/code/Magento/Webapi/i18n/en_US.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/en_US.csv
+++ b/app/code/Magento/Webapi/i18n/en_US.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/es_ES.csv b/app/code/Magento/Webapi/i18n/es_ES.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/es_ES.csv
+++ b/app/code/Magento/Webapi/i18n/es_ES.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/fr_FR.csv b/app/code/Magento/Webapi/i18n/fr_FR.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/fr_FR.csv
+++ b/app/code/Magento/Webapi/i18n/fr_FR.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/nl_NL.csv b/app/code/Magento/Webapi/i18n/nl_NL.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/nl_NL.csv
+++ b/app/code/Magento/Webapi/i18n/nl_NL.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/pt_BR.csv b/app/code/Magento/Webapi/i18n/pt_BR.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/pt_BR.csv
+++ b/app/code/Magento/Webapi/i18n/pt_BR.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/app/code/Magento/Webapi/i18n/zh_CN.csv b/app/code/Magento/Webapi/i18n/zh_CN.csv
index 38d04492b4c50..83b5ca4338967 100644
--- a/app/code/Magento/Webapi/i18n/zh_CN.csv
+++ b/app/code/Magento/Webapi/i18n/zh_CN.csv
@@ -13,7 +13,7 @@ API,API
"Request method is invalid.","Request method is invalid."
"Decoding error.","Decoding error."
"Decoding error: %1%2%3%4","Decoding error: %1%2%3%4"
-"Server cannot understand Accept HTTP header media type.","Server cannot understand Accept HTTP header media type."
+"Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer.", "Server cannot match any of the given Accept HTTP header media type(s) from the request: "%1 with media types from the config of response renderer."
"Request does not match any route.","Request does not match any route."
"Not allowed parameters: %1. Please use only %2 and %3.","Not allowed parameters: %1. Please use only %2 and %3."
"Incorrect format of WSDL request URI or Requested services are missing.","Incorrect format of WSDL request URI or Requested services are missing."
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Rest.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Rest.php
index 4ddaae1a4e404..26ae75ed20431 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Rest.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Rest.php
@@ -60,11 +60,13 @@ public function __construct()
/**
* {@inheritdoc}
- * @throws \Exception
+ * @throws \LogicException
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
- public function call($serviceInfo, $arguments = [])
+ public function call($serviceInfo, $arguments = [], $storeCode = null)
{
- $resourcePath = '/' . $this->defaultStoreCode . $this->_getRestResourcePath($serviceInfo);
+ $storeCode = !is_null($storeCode) ? (string)$storeCode : $this->defaultStoreCode;
+ $resourcePath = '/' . $storeCode . $this->_getRestResourcePath($serviceInfo);
$httpMethod = $this->_getRestHttpMethod($serviceInfo);
//Get a valid token
$accessCredentials = \Magento\TestFramework\Authentication\OauthHelper::getApiAccessCredentials();
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php
index 863cefe47b2e0..d2055f96d98a0 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/Adapter/Soap.php
@@ -53,11 +53,11 @@ public function __construct()
/**
* {@inheritdoc}
*/
- public function call($serviceInfo, $arguments = [])
+ public function call($serviceInfo, $arguments = [], $storeCode = null)
{
$soapOperation = $this->_getSoapOperation($serviceInfo);
$arguments = $this->_converter->convertKeysToCamelCase($arguments);
- $soapResponse = $this->_getSoapClient($serviceInfo)->$soapOperation($arguments);
+ $soapResponse = $this->_getSoapClient($serviceInfo, $storeCode)->$soapOperation($arguments);
//Convert to snake case for tests to use same assertion data for both SOAP and REST tests
$result = (is_array($soapResponse) || is_object($soapResponse))
? $this->toSnakeCase($this->_converter->convertStdObjectToArray($soapResponse, true))
@@ -71,12 +71,14 @@ public function call($serviceInfo, $arguments = [])
* Get proper SOAP client instance that is initialized with with WSDL corresponding to requested service interface.
*
* @param string $serviceInfo PHP service interface name, should include version if present
+ * @param string|null $storeCode
* @return \Zend\Soap\Client
*/
- protected function _getSoapClient($serviceInfo)
+ protected function _getSoapClient($serviceInfo, $storeCode = null)
{
$wsdlUrl = $this->generateWsdlUrl(
- [$this->_getSoapServiceName($serviceInfo) . $this->_getSoapServiceVersion($serviceInfo)]
+ [$this->_getSoapServiceName($serviceInfo) . $this->_getSoapServiceVersion($serviceInfo)],
+ $storeCode
);
/** Check if there is SOAP client initialized with requested WSDL available */
if (!isset($this->_soapClients[$wsdlUrl])) {
@@ -117,16 +119,19 @@ public function instantiateSoapClient($wsdlUrl, $token = null)
* 'catalogProductV1',
* 'customerV2'
* );
+ * @param string|null $storeCode
* @return string
*/
- public function generateWsdlUrl($services)
+ public function generateWsdlUrl($services, $storeCode = null)
{
/** Sort list of services to avoid having different WSDL URLs for the identical lists of services. */
//TODO: This may change since same resource of multiple versions may be allowed after namespace changes
ksort($services);
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
- $storeManager = Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface');
- $storeCode = $storeManager->getStore()->getCode();
+ $storeCode = !is_null($storeCode)
+ ? (string)$storeCode
+ : Bootstrap::getObjectManager()->get('Magento\Store\Model\StoreManagerInterface')->getStore()->getCode();
+
/** TESTS_BASE_URL is initialized in PHPUnit configuration */
$wsdlUrl = rtrim(TESTS_BASE_URL, '/') . self::WSDL_BASE_PATH . '/' . $storeCode . '?wsdl=1&services=';
$wsdlResourceArray = [];
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/AdapterInterface.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/AdapterInterface.php
index ac06611fd3f12..42e3828cbd304 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/AdapterInterface.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/Webapi/AdapterInterface.php
@@ -32,7 +32,8 @@ interface AdapterInterface
* );
*
* @param array $arguments
+ * @param string|null $storeCode if store code not provided, default store code will be used
* @return array|string|int|float|bool
*/
- public function call($serviceInfo, $arguments = []);
+ public function call($serviceInfo, $arguments = [], $storeCode = null);
}
diff --git a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php
index 3ef4de527c139..e0f80d3ef43a7 100644
--- a/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php
+++ b/dev/tests/api-functional/framework/Magento/TestFramework/TestCase/WebapiAbstract.php
@@ -155,15 +155,16 @@ protected function tearDown()
* @param array $serviceInfo
* @param array $arguments
* @param string|null $webApiAdapterCode
+ * @param string|null $storeCode
* @return array|int|string|float|bool Web API call results
*/
- protected function _webApiCall($serviceInfo, $arguments = [], $webApiAdapterCode = null)
+ protected function _webApiCall($serviceInfo, $arguments = [], $webApiAdapterCode = null, $storeCode = null)
{
if (is_null($webApiAdapterCode)) {
/** Default adapter code is defined in PHPUnit configuration */
$webApiAdapterCode = strtolower(TESTS_WEB_API_ADAPTER);
}
- return $this->_getWebApiAdapter($webApiAdapterCode)->call($serviceInfo, $arguments);
+ return $this->_getWebApiAdapter($webApiAdapterCode)->call($serviceInfo, $arguments, $storeCode);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php
index 460a4717ff07d..df6327ca3f6c6 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/AttributeSetRepositoryTest.php
@@ -184,8 +184,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => '/V1/products/attribute-sets/sets/list',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => '/V1/products/attribute-sets/sets/list' . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => 'catalogAttributeSetRepositoryV1',
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php
index c5efb129a0011..305248ccf0319 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/CategoryAttributeRepositoryTest.php
@@ -51,8 +51,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeGroupRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeGroupRepositoryTest.php
index a94c911c5f3a9..cade639f646a1 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeGroupRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeGroupRepositoryTest.php
@@ -112,8 +112,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . "/groups/list",
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/groups/list' . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php
index 179c7178c8e1d..c3b728a94c223 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductAttributeRepositoryTest.php
@@ -52,8 +52,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php
index 8fd10a0c16c90..f47e80bf63acf 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryInterfaceTest.php
@@ -183,8 +183,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php
new file mode 100644
index 0000000000000..d2bdd2ca75acb
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductRepositoryMultiStoreTest.php
@@ -0,0 +1,115 @@
+ 'simple',
+ Product::NAME => 'Simple Related Product',
+ Product::TYPE_ID => 'simple',
+ Product::PRICE => 10
+ ],
+ [
+ Product::SKU => 'simple_with_cross',
+ Product::NAME => 'Simple Product With Related Product',
+ Product::TYPE_ID => 'simple',
+ Product::PRICE => 10
+ ],
+ ];
+
+ /**
+ * Create another store one time for testSearch
+ * @magentoApiDataFixture Magento/Core/_files/store.php
+ */
+ public function testCreateAnotherStore()
+ {
+ /** @var $store \Magento\Store\Model\Store */
+ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store');
+ $store->load('fixturestore');
+ $this->assertNotNull($store->getId());
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
+ * @depends testCreateAnotherStore
+ */
+ public function testGetMultiStore()
+ {
+ $productData = $this->productData[0];
+ $nameInFixtureStore = 'Name in fixture store';
+ /** @var $store \Magento\Store\Model\Group */
+ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Group');
+ $store->load(self::STORE_CODE_FROM_FIXTURE);
+ $this->assertNotNull($store->getId(), 'Precondition failed: fixture store was not created.');
+ $sku = $productData[Product::SKU];
+ /** @var \Magento\Catalog\Model\Product $product */
+ $product = Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product');
+ $product->load($product->getIdBySku($sku));
+ $product->setName($nameInFixtureStore)->setStoreId($store->getId())->save();
+ $serviceInfo = [
+ 'rest' => [
+ 'resourcePath' => self::RESOURCE_PATH . '/' . $sku,
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET
+ ],
+ 'soap' => [
+ 'service' => self::SERVICE_NAME,
+ 'serviceVersion' => self::SERVICE_VERSION,
+ 'operation' => self::SERVICE_NAME . 'get'
+ ]
+ ];
+
+ $requestData = ['id' => $sku, 'productSku' => $sku];
+ $defaultStoreResponse = $this->_webApiCall($serviceInfo, $requestData);
+ $nameInDefaultStore = 'Simple Product';
+ $this->assertEquals(
+ $nameInDefaultStore,
+ $defaultStoreResponse[Product::NAME],
+ 'Product name in default store is invalid.'
+ );
+ $fixtureStoreResponse = $this->_webApiCall($serviceInfo, $requestData, null, self::STORE_CODE_FROM_FIXTURE);
+ $this->assertEquals(
+ $nameInFixtureStore,
+ $fixtureStoreResponse[Product::NAME],
+ 'Product name in fixture store is invalid.'
+ );
+ }
+
+ /**
+ * Remove test store
+ */
+ public static function tearDownAfterClass()
+ {
+ parent::tearDownAfterClass();
+ /** @var \Magento\Framework\Registry $registry */
+ $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Framework\Registry');
+
+ $registry->unregister('isSecureArea');
+ $registry->register('isSecureArea', true);
+
+ /** @var $store \Magento\Store\Model\Store */
+ $store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store');
+ $store->load('fixturestore');
+ if ($store->getId()) {
+ $store->delete();
+ }
+
+ $registry->unregister('isSecureArea');
+ $registry->register('isSecureArea', false);
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php b/dev/tests/api-functional/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php
index b00bd208f2df0..88ca0a2d2ebaa 100644
--- a/dev/tests/api-functional/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Checkout/Service/V1/Cart/ReadServiceTest.php
@@ -205,18 +205,6 @@ public function testGetCartList()
{
$cart = $this->getCart('test01');
- $serviceInfo = [
- 'rest' => [
- 'resourcePath' => '/V1/carts',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
- ],
- 'soap' => [
- 'service' => 'checkoutCartReadServiceV1',
- 'serviceVersion' => 'V1',
- 'operation' => 'checkoutCartReadServiceV1GetCartList',
- ],
- ];
-
// The following two filters are used as alternatives. The target cart does not match the first one.
$grandTotalFilter = $this->filterBuilder->setField('grand_total')
->setConditionType('gteq')
@@ -247,6 +235,17 @@ public function testGetCartList()
$searchCriteria = $this->searchBuilder->create()->__toArray();
$requestData = ['searchCriteria' => $searchCriteria];
+ $serviceInfo = [
+ 'rest' => [
+ 'resourcePath' => '/V1/carts' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
+ ],
+ 'soap' => [
+ 'service' => 'checkoutCartReadServiceV1',
+ 'serviceVersion' => 'V1',
+ 'operation' => 'checkoutCartReadServiceV1GetCartList',
+ ],
+ ];
$searchResult = $this->_webApiCall($serviceInfo, $requestData);
$this->assertArrayHasKey('total_count', $searchResult);
$this->assertEquals(1, $searchResult['total_count']);
@@ -273,6 +272,14 @@ public function testGetCartList()
*/
public function testGetCartListThrowsExceptionIfProvidedSearchFieldIsInvalid()
{
+ $invalidFilter = $this->filterBuilder->setField('invalid_field')
+ ->setConditionType('eq')
+ ->setValue(0)
+ ->create();
+
+ $this->searchBuilder->addFilter([$invalidFilter]);
+ $searchCriteria = $this->searchBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchCriteria];
$serviceInfo = [
'soap' => [
'service' => 'checkoutCartReadServiceV1',
@@ -280,19 +287,10 @@ public function testGetCartListThrowsExceptionIfProvidedSearchFieldIsInvalid()
'operation' => 'checkoutCartReadServiceV1GetCartList',
],
'rest' => [
- 'resourcePath' => '/V1/carts',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => '/V1/carts' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
];
-
- $invalidFilter = $this->filterBuilder->setField('invalid_field')
- ->setConditionType('eq')
- ->setValue(0)
- ->create();
-
- $this->searchBuilder->addFilter([$invalidFilter]);
- $searchCriteria = $this->searchBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchCriteria];
$this->_webApiCall($serviceInfo, $requestData);
}
}
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 7e51b4656f240..1c3e652050ece 100644
--- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php
@@ -345,10 +345,15 @@ public function testSearchCustomers()
->setValue($customerData[Customer::EMAIL])
->create();
$this->searchCriteriaBuilder->addFilter([$filter]);
+ $searchData = $this->dataObjectProcessor->buildOutputDataArray(
+ $this->searchCriteriaBuilder->create(),
+ 'Magento\Framework\Api\SearchCriteriaInterface'
+ );
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_POST,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -356,11 +361,6 @@ public function testSearchCustomers()
'operation' => self::SERVICE_NAME . 'getList',
],
];
- $searchData = $this->dataObjectProcessor->buildOutputDataArray(
- $this->searchCriteriaBuilder->create(),
- 'Magento\Framework\Api\SearchCriteriaInterface'
- );
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($customerData[Customer::ID], $searchResults['items'][0][Customer::ID]);
@@ -450,10 +450,12 @@ public function testSearchCustomersMultipleFiltersWithSort()
$this->searchCriteriaBuilder->setSortOrders([$sortOrder]);
$searchCriteria = $this->searchCriteriaBuilder->create();
+ $searchData = $searchCriteria->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_POST,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -461,8 +463,6 @@ public function testSearchCustomersMultipleFiltersWithSort()
'operation' => self::SERVICE_NAME . 'getList',
],
];
- $searchData = $searchCriteria->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(2, $searchResults['total_count']);
$this->assertEquals($customerData1[Customer::ID], $searchResults['items'][0][Customer::ID]);
@@ -526,10 +526,12 @@ public function testSearchCustomersNonExistentMultipleFilters()
$this->searchCriteriaBuilder->addFilter([$filter1, $filter2]);
$this->searchCriteriaBuilder->addFilter([$filter3]);
$searchCriteria = $this->searchCriteriaBuilder->create();
+ $searchData = $searchCriteria->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_POST,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -537,8 +539,6 @@ public function testSearchCustomersNonExistentMultipleFilters()
'operation' => self::SERVICE_NAME . 'getList',
],
];
- $searchData = $searchCriteria->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(0, $searchResults['total_count'], 'No results expected for non-existent email.');
}
@@ -603,10 +603,12 @@ public function testSearchCustomersMultipleFilterGroups()
$this->searchCriteriaBuilder->addFilter([$filter2, $filter3]);
$this->searchCriteriaBuilder->addFilter([$filter4]);
$searchCriteria = $this->searchCriteriaBuilder->setCurrentPage(1)->setPageSize(10)->create();
+ $searchData = $searchCriteria->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_POST,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -614,8 +616,6 @@ public function testSearchCustomersMultipleFilterGroups()
'operation' => self::SERVICE_NAME . 'getList',
],
];
- $searchData = $searchCriteria->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($customerData1[Customer::ID], $searchResults['items'][0][Customer::ID]);
@@ -631,6 +631,7 @@ public function testSearchCustomersMultipleFilterGroups()
$searchCriteria = $this->searchCriteriaBuilder->create();
$searchData = $searchCriteria->__toArray();
$requestData = ['searchCriteria' => $searchData];
+ $serviceInfo['rest']['resourcePath'] = self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData);
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(0, $searchResults['total_count']);
}
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 793af789e5178..9223adbf2b60e 100644
--- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/GroupRepositoryTest.php
@@ -938,10 +938,13 @@ public function testSearchGroups($filterField, $filterValue, $expectedResult)
->create();
$searchCriteriaBuilder->addFilter([$filter]);
+
+ $searchData = $searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . "/search",
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_POST,
+ 'resourcePath' => self::RESOURCE_PATH . "/search" . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -950,9 +953,6 @@ public function testSearchGroups($filterField, $filterValue, $expectedResult)
],
];
- $searchData = $searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
-
$searchResult = $this->_webApiCall($serviceInfo, $requestData);
if (is_null($expectedResult)) {
diff --git a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php
index 27b9e4be212d9..9ea479a268aea 100644
--- a/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Eav/Api/AttributeSetRepositoryTest.php
@@ -216,8 +216,8 @@ public function testGetList()
$serviceInfo = [
'rest' => [
- 'resourcePath' => '/V1/eav/attribute-sets/list',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => '/V1/eav/attribute-sets/list' . '?' . http_build_query($searchCriteria),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => 'eavAttributeSetRepositoryV1',
diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php
index 35c56c2db394c..81d08369c23b0 100644
--- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/CreditmemoListTest.php
@@ -73,7 +73,7 @@ public function testCreditmemoList()
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
- 'httpMethod' => Config::HTTP_METHOD_PUT,
+ 'httpMethod' => Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_READ_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php
index 75cea21afe01c..a979af5597fe7 100644
--- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/InvoiceListTest.php
@@ -58,7 +58,7 @@ public function testInvoiceList()
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
- 'httpMethod' => Config::HTTP_METHOD_PUT,
+ 'httpMethod' => Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_READ_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderListTest.php
index b9aa3fb084e57..2d9fdca5b07e7 100644
--- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderListTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/OrderListTest.php
@@ -59,7 +59,7 @@ public function testOrderList()
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
- 'httpMethod' => Config::HTTP_METHOD_PUT,
+ 'httpMethod' => Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_READ_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php
index cded7d7733b54..eb35a909f80ea 100644
--- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/ShipmentListTest.php
@@ -51,7 +51,7 @@ public function testShipmentList()
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
- 'httpMethod' => Config::HTTP_METHOD_PUT,
+ 'httpMethod' => Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_READ_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php
index 008c16c3f533d..4d7782262d5f5 100644
--- a/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Sales/Service/V1/TransactionTest.php
@@ -114,7 +114,7 @@ public function testTransactionList($filters)
$serviceInfo = [
'rest' => [
'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($requestData),
- 'httpMethod' => Config::HTTP_METHOD_PUT,
+ 'httpMethod' => Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_READ_NAME,
diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php
index 3cd13949a3b68..40af69cc8c541 100644
--- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxClassRepositoryTest.php
@@ -226,10 +226,12 @@ public function testSearchTaxClass()
->setValue($taxClassName)
->create();
$this->searchCriteriaBuilder->addFilter([$filter]);
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -237,8 +239,6 @@ public function testSearchTaxClass()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($taxClassName, $searchResults['items'][0][$taxClassNameField]);
@@ -276,10 +276,12 @@ public function testSearchTaxClassMultipleFilterGroups()
$this->searchCriteriaBuilder->addFilter([$filter1, $filter2]);
$this->searchCriteriaBuilder->addFilter([$filter3, $filter4]);
$searchCriteria = $this->searchCriteriaBuilder->setCurrentPage(1)->setPageSize(10)->create();
+ $searchData = $searchCriteria->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => RestConfig::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => RestConfig::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -287,8 +289,6 @@ public function testSearchTaxClassMultipleFilterGroups()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $searchCriteria->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(2, $searchResults['total_count']);
$this->assertEquals($productTaxClass[Data\TaxClassInterface::KEY_NAME],
@@ -302,6 +302,7 @@ public function testSearchTaxClassMultipleFilterGroups()
$searchCriteria = $this->searchCriteriaBuilder->create();
$searchData = $searchCriteria->__toArray();
$requestData = ['searchCriteria' => $searchData];
+ $serviceInfo['rest']['resourcePath'] = self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData);
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($customerTaxClass[Data\TaxClassInterface::KEY_NAME],
diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php
index acecc61e5d151..386b8efbc2ea6 100644
--- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRateRepositoryTest.php
@@ -433,10 +433,12 @@ public function testSearchTaxRates()
$this->searchCriteriaBuilder->addFilter([$filter]);
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -444,8 +446,6 @@ public function testSearchTaxRates()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
/** @var \Magento\Framework\Api\SearchResults $searchResults */
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
@@ -484,10 +484,12 @@ public function testSearchTaxRatesCz()
// Order them by descending postcode (not the default order)
$this->searchCriteriaBuilder->addFilter([$filter])
->addSortOrder($sortOrder);
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -495,8 +497,6 @@ public function testSearchTaxRatesCz()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
/** @var \Magento\Framework\Api\SearchResults $searchResults */
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
diff --git a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRuleRepositoryInterfaceTest.php b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRuleRepositoryInterfaceTest.php
index 2af580535cab0..730de3d32dc0a 100644
--- a/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRuleRepositoryInterfaceTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Tax/Api/TaxRuleRepositoryInterfaceTest.php
@@ -269,10 +269,12 @@ public function testSearchTaxRulesSimple()
$fixtureRule = $this->getFixtureTaxRules()[1];
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -280,8 +282,6 @@ public function testSearchTaxRulesSimple()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
/** @var \Magento\Framework\Api\SearchResults $searchResults */
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
@@ -324,10 +324,12 @@ public function testSearchTaxRulesCodeLike()
$fixtureRule = $this->getFixtureTaxRules()[1];
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -335,8 +337,6 @@ public function testSearchTaxRulesCodeLike()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
/** @var \Magento\Framework\Api\SearchResults $searchResults */
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
@@ -514,10 +514,17 @@ public function testSearchTaxRule()
{
$fixtureRule = $this->getFixtureTaxRules()[0];
+
+ $filter = $this->filterBuilder->setField('code')
+ ->setValue($fixtureRule->getCode())
+ ->create();
+ $this->searchCriteriaBuilder->addFilter([$filter]);
+ $searchData = $this->searchCriteriaBuilder->create()->__toArray();
+ $requestData = ['searchCriteria' => $searchData];
$serviceInfo = [
'rest' => [
- 'resourcePath' => self::RESOURCE_PATH . '/search',
- 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_PUT,
+ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData),
+ 'httpMethod' => \Magento\Webapi\Model\Rest\Config::HTTP_METHOD_GET,
],
'soap' => [
'service' => self::SERVICE_NAME,
@@ -525,13 +532,6 @@ public function testSearchTaxRule()
'operation' => self::SERVICE_NAME . 'GetList',
],
];
-
- $filter = $this->filterBuilder->setField('code')
- ->setValue($fixtureRule->getCode())
- ->create();
- $this->searchCriteriaBuilder->addFilter([$filter]);
- $searchData = $this->searchCriteriaBuilder->create()->__toArray();
- $requestData = ['searchCriteria' => $searchData];
$searchResults = $this->_webApiCall($serviceInfo, $requestData);
$this->assertEquals(1, $searchResults['total_count']);
$this->assertEquals($fixtureRule->getId(), $searchResults['items'][0]["id"]);
diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/ConfigTest.php
index aeae2f32ecd54..3aeb7044dc267 100644
--- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/ConfigTest.php
+++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/System/ConfigTest.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Backend\Controller\Adminhtml\System;
+use Magento\TestFramework\Helper\Bootstrap;
+
/**
* @magentoAppArea adminhtml
*/
@@ -15,4 +17,69 @@ public function testEditAction()
$this->dispatch('backend/admin/system_config/edit');
$this->assertContains('getResponse()->getBody());
}
+
+ /**
+ * @magentoAppIsolation enabled
+ * @magentoDbIsolation enabled
+ */
+ public function testChangeBaseUrl()
+ {
+ $defaultHost = Bootstrap::getObjectManager()->create('Magento\Framework\Url')->getBaseUrl();
+ $newHost = 'm2test123.loc';
+ $request = $this->getRequest();
+ $request->setPost(
+ ['groups' =>
+ ['unsecure' =>
+ ['fields' =>
+ ['base_url' =>
+ ['value' => 'http://' . $newHost . '/']
+ ]
+ ]
+ ],
+ 'config_state' =>
+ ['web_unsecure' => 1]
+ ]
+ )->setParam(
+ 'section',
+ 'web'
+ );
+ $this->dispatch('backend/admin/system_config/save');
+
+ $this->assertTrue($this->getResponse()->isRedirect(), 'Redirect was expected, but none was performed.');
+
+ /** @var array|bool $url */
+ $url = parse_url($this->getResponse()->getHeader('Location')['value']);
+ $this->assertArrayNotHasKey(
+ 'query',
+ $url,
+ 'No GET params, including "SID", were expected, but somewhat exists'
+ );
+ $this->assertEquals($newHost, $url['host'], 'A new host in the url expected, but there is old one');
+ $this->resetBaseUrl($defaultHost);
+ }
+
+ /**
+ * Reset test framework default base url
+ */
+ protected function resetBaseUrl($defaultHost)
+ {
+ $baseUrlData = [
+ 'section' => 'web',
+ 'website' => NULL,
+ 'store' => NULL,
+ 'groups' => [
+ 'unsecure' => [
+ 'fields' => [
+ 'base_url' => [
+ 'value' => $defaultHost
+ ]
+ ]
+ ]
+ ]
+ ];
+ Bootstrap::getObjectManager()->create('Magento\Backend\Model\Config\Factory')
+ ->create()
+ ->addData($baseUrlData)
+ ->save();
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/store.php b/dev/tests/integration/testsuite/Magento/Core/_files/store.php
index 5dd2b6aad9b2b..dcb4f52e6722d 100644
--- a/dev/tests/integration/testsuite/Magento/Core/_files/store.php
+++ b/dev/tests/integration/testsuite/Magento/Core/_files/store.php
@@ -5,28 +5,31 @@
*/
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Store\Model\Store');
-$websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
- 'Magento\Store\Model\StoreManagerInterface'
-)->getWebsite()->getId();
-$groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
- 'Magento\Store\Model\StoreManagerInterface'
-)->getWebsite()->getDefaultGroupId();
-$store->setCode(
- 'fixturestore'
-)->setWebsiteId(
- $websiteId
-)->setGroupId(
- $groupId
-)->setName(
- 'Fixture Store'
-)->setSortOrder(
- 10
-)->setIsActive(
- 1
-);
-$store->save();
+$storeCode = 'fixturestore';
+if (!$store->load($storeCode)->getId()) {
+ $websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ 'Magento\Store\Model\StoreManagerInterface'
+ )->getWebsite()->getId();
+ $groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ 'Magento\Store\Model\StoreManagerInterface'
+ )->getWebsite()->getDefaultGroupId();
+ $store->setCode(
+ $storeCode
+ )->setWebsiteId(
+ $websiteId
+ )->setGroupId(
+ $groupId
+ )->setName(
+ 'Fixture Store'
+ )->setSortOrder(
+ 10
+ )->setIsActive(
+ 1
+ );
+ $store->save();
-/* Refresh stores memory cache */
-\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
- 'Magento\Store\Model\StoreManagerInterface'
-)->reinitStores();
+ /* Refresh stores memory cache */
+ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ 'Magento\Store\Model\StoreManagerInterface'
+ )->reinitStores();
+}
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
index e0aa12b98cee2..2280270e18076 100755
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
@@ -983,11 +983,11 @@ public function testValidateCustomerWithAddressFailure()
$body = $this->getResponse()->getBody();
$this->assertContains('{"error":1,"html_message":', $body);
- $this->assertContains('Please correct this email address: \"*\".', $body);
- $this->assertContains('\"First Name\" is a required value.', $body);
- $this->assertContains('\"Last Name\" is a required value.', $body);
- $this->assertContains('\"Phone Number\" is a required value.', $body);
- $this->assertContains('\"Country\" is a required value.', $body);
+ $this->assertContains('Please correct this email address: "*".', $body);
+ $this->assertContains('"First Name" is a required value.', $body);
+ $this->assertContains('"Last Name" is a required value.', $body);
+ $this->assertContains('"Phone Number" is a required value.', $body);
+ $this->assertContains('"Country" is a required value.', $body);
}
/**
diff --git a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
index 49de5e222441f..f4fcd2bc29988 100644
--- a/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
+++ b/dev/tests/integration/testsuite/Magento/User/Controller/Adminhtml/UserTest.php
@@ -219,6 +219,6 @@ public function testValidateActionError()
$body = $this->getResponse()->getBody();
$this->assertContains('{"error":1,"html_message":', $body);
- $this->assertContains('Please correct this email address: \"example@domain.cim\"', $body);
+ $this->assertContains('Please correct this email address: "example@domain.cim"', $body);
}
}
diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
index 1fc8ca3b21012..bbd9e15d86aec 100644
--- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
+++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/words_ce.xml
@@ -62,6 +62,10 @@
dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php
overriden
+ -
+ dev/tests/api-functional/testsuite/Magento/Webapi/Routing/RequestIdOverrideTest.php
+ overriden
+
-
app/code/Magento/Bundle/view/adminhtml/templates/product/edit/bundle.phtml
head.js
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt
index b08055eedb4f7..0e230d6265703 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt
@@ -32,10 +32,10 @@ dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeMessTest/phpmd/input
lib/internal/Magento/Framework/Translate/Adapter.php
# __ method for Translate cannot be in camelCase
lib/internal/Magento/Framework/Translate/AdapterInterface.php
-# PSR-1 not applied to
-dev/tests/integration/testsuite/Magento
-# PSR-1 not applied to
-dev/tests/unit/testsuite/Magento
+# Exclude unit, integration, and api-functional tests from PSR-X code style check
+dev/tests/api-functional
+dev/tests/integration
+dev/tests/unit
# Newer version of phpcs does not complain about spacing issue. This appears to be a bug in the phpcs version that is currently run in bamboo.
app/code/Magento/Sales/Model/Order/Payment/Transaction.php
vendor
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/LinkTypeProviderTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/LinkTypeProviderTest.php
index b6a10155bebcb..095253b7ed2da 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/LinkTypeProviderTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/LinkTypeProviderTest.php
@@ -36,7 +36,10 @@ protected function setUp()
{
$this->linkTypeBuilderMock = $this->getMock(
'Magento\Catalog\Api\Data\ProductLinkTypeDataBuilder',
- ['create', 'populateWithArray']
+ ['create', 'populateWithArray'],
+ [],
+ '',
+ false
);
$this->linkAttributeBuilderMock = $this->getMock(
'Magento\Catalog\Api\Data\ProductLinkAttributeDataBuilder',
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Media/AttributeManagementTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Media/AttributeManagementTest.php
index 059f6b0a002b7..c188c4997faa0 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Media/AttributeManagementTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Media/AttributeManagementTest.php
@@ -5,7 +5,7 @@
*/
namespace Magento\Catalog\Model\Product\Media;
-use \Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product;
class AttributeManagementTest extends \PHPUnit_Framework_TestCase
{
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
index ebe5b6bcd454e..7612c2559d051 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php
@@ -5,8 +5,6 @@
*/
namespace Magento\Catalog\Model\Resource\Eav;
-use \Magento\Catalog\Model\Resource\Eav\Attribute;
-
class AttributeTest extends \PHPUnit_Framework_TestCase
{
/**
diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NotifyStockTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NotifyStockTest.php
index 047db70e9209e..15889d42dbef4 100644
--- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NotifyStockTest.php
+++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Rss/Product/NotifyStockTest.php
@@ -60,7 +60,13 @@ protected function setUp()
$this->productFactory->expects($this->any())->method('create')->will($this->returnValue($this->product));
$this->stock = $this->getMock('Magento\CatalogInventory\Model\Resource\Stock', [], [], '', false);
- $this->stockFactory = $this->getMock('Magento\CatalogInventory\Model\Resource\StockFactory', ['create']);
+ $this->stockFactory = $this->getMock(
+ 'Magento\CatalogInventory\Model\Resource\StockFactory',
+ ['create'],
+ [],
+ '',
+ false
+ );
$this->stockFactory->expects($this->any())->method('create')->will($this->returnValue($this->stock));
$this->status = $this->getMock('Magento\Catalog\Model\Product\Attribute\Source\Status');
diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php
index 284612012fd00..ef3d0a3c28986 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php
@@ -65,7 +65,13 @@ protected function setUp()
'',
false
);
- $this->_factoryTextMock = $this->getMock('Magento\Framework\Data\Form\Element\TextFactory', ['create']);
+ $this->_factoryTextMock = $this->getMock(
+ 'Magento\Framework\Data\Form\Element\TextFactory',
+ [],
+ [],
+ '',
+ false
+ );
$objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this);
$this->_block = $objectManagerHelper->getObject(
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Product/PriceModifierTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Product/PriceModifierTest.php
index 32f1fbe7712d0..089a955d8a86c 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Product/PriceModifierTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/Product/PriceModifierTest.php
@@ -29,7 +29,13 @@ class PriceModifierTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->ruleFactoryMock = $this->getMock('Magento\CatalogRule\Model\RuleFactory', ['create']);
+ $this->ruleFactoryMock = $this->getMock(
+ 'Magento\CatalogRule\Model\RuleFactory',
+ ['create'],
+ [],
+ '',
+ false
+ );
$this->productMock = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false);
$this->ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', [], [], '', false);
$this->priceModifier = new \Magento\CatalogRule\Model\Product\PriceModifier($this->ruleFactoryMock);
diff --git a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/RuleTest.php b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/RuleTest.php
index 326af53f38a44..61941e3f63dfe 100644
--- a/dev/tests/unit/testsuite/Magento/CatalogRule/Model/RuleTest.php
+++ b/dev/tests/unit/testsuite/Magento/CatalogRule/Model/RuleTest.php
@@ -39,7 +39,10 @@ protected function setUp()
'Magento\CatalogRule\Model\Rule\Condition\CombineFactory',
[
'create'
- ]
+ ],
+ [],
+ '',
+ false
);
$this->productModel = $this->getMock(
'Magento\Catalog\Model\Product',
diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
index f1b69f8016d2f..b982c959cb798 100644
--- a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
+++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php
@@ -164,9 +164,19 @@ protected function setUp()
$this->_resizeParameters = ['width' => 100, 'height' => 50];
$this->_storageCollectionFactoryMock = $this->getMock(
- 'Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory'
+ 'Magento\Cms\Model\Wysiwyg\Images\Storage\CollectionFactory',
+ [],
+ [],
+ '',
+ false
+ );
+ $this->_storageFileFactoryMock = $this->getMock(
+ 'Magento\Core\Model\File\Storage\FileFactory',
+ [],
+ [],
+ '',
+ false
);
- $this->_storageFileFactoryMock = $this->getMock('Magento\Core\Model\File\Storage\FileFactory');
$this->_storageDatabaseFactoryMock = $this->getMock(
'Magento\Core\Model\File\Storage\DatabaseFactory',
[],
@@ -175,9 +185,13 @@ protected function setUp()
false
);
$this->_directoryDatabaseFactoryMock = $this->getMock(
- 'Magento\Core\Model\File\Storage\Directory\DatabaseFactory'
+ 'Magento\Core\Model\File\Storage\Directory\DatabaseFactory',
+ [],
+ [],
+ '',
+ false
);
- $this->_uploaderFactoryMock = $this->getMock('Magento\Core\Model\File\UploaderFactory');
+ $this->_uploaderFactoryMock = $this->getMock('Magento\Core\Model\File\UploaderFactory', [], [], '', false);
$this->_sessionMock = $this->getMock('Magento\Backend\Model\Session', [], [], '', false);
$this->_backendUrlMock = $this->getMock('Magento\Backend\Model\Url', [], [], '', false);
diff --git a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/LinkManagementTest.php b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/LinkManagementTest.php
index b1377d38aea32..0fd724f86edb2 100644
--- a/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/LinkManagementTest.php
+++ b/dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/LinkManagementTest.php
@@ -6,7 +6,7 @@
namespace Magento\ConfigurableProduct\Model;
-use \Magento\ConfigurableProduct\Model\Product\Type\Configurable;
+use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
class LinkManagementTest extends \PHPUnit_Framework_TestCase
{
diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/View/DesignTest.php
index e28e6cdfca21a..d8e6b26db1304 100644
--- a/dev/tests/unit/testsuite/Magento/Core/Model/View/DesignTest.php
+++ b/dev/tests/unit/testsuite/Magento/Core/Model/View/DesignTest.php
@@ -24,7 +24,7 @@ protected function setUp()
'\Magento\Framework\View\Design\Theme\FlyweightFactory', [], [], '', false
);
$config = $this->getMockForAbstractClass('\Magento\Framework\App\Config\ScopeConfigInterface');
- $themeFactory = $this->getMock('\Magento\Core\Model\ThemeFactory');
+ $themeFactory = $this->getMock('\Magento\Core\Model\ThemeFactory', [], [], '', false);
$this->objectManager = $this->getMockForAbstractClass('\Magento\Framework\ObjectManagerInterface');
$state = $this->getMock('\Magento\Framework\App\State', [], [], '', false);
$themes = [];
diff --git a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
index cd6775c63e77c..48c4befe216c1 100644
--- a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/AddressTest.php
@@ -133,7 +133,7 @@ protected function _getModelDependencies()
foreach ($this->_attributes as $attributeData) {
$arguments = $this->_objectManager->getConstructArguments(
'Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
- ['eavTypeFactory' => $this->getMock('Magento\Eav\Model\Entity\TypeFactory')]
+ ['eavTypeFactory' => $this->getMock('Magento\Eav\Model\Entity\TypeFactory', [], [], '', false)]
);
$arguments['data'] = $attributeData;
$attribute = $this->getMockForAbstractClass(
diff --git a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
index bbabb5b048dab..0d62e8d088eb4 100644
--- a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
+++ b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php
@@ -108,7 +108,7 @@ protected function _getModelDependencies()
foreach ($this->_attributes as $attributeData) {
$arguments = $objectManagerHelper->getConstructArguments(
'Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
- ['eavTypeFactory' => $this->getMock('Magento\Eav\Model\Entity\TypeFactory')]
+ ['eavTypeFactory' => $this->getMock('Magento\Eav\Model\Entity\TypeFactory', [], [], '', false)]
);
$arguments['data'] = $attributeData;
$attribute = $this->getMockForAbstractClass(
diff --git a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
index daa8ae9097796..309e4732d5b5d 100644
--- a/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
+++ b/dev/tests/unit/testsuite/Magento/CustomerImportExport/Model/Import/AddressTest.php
@@ -200,7 +200,7 @@ protected function _createAttrCollectionMock()
$this->getMock('Magento\Framework\Registry'),
$this->getMock('Magento\Core\Helper\Data', [], [], '', false, false),
$this->getMock('Magento\Eav\Model\Config', [], [], '', false, false),
- $this->getMock('Magento\Eav\Model\Entity\TypeFactory'),
+ $this->getMock('Magento\Eav\Model\Entity\TypeFactory', [], [], '', false),
$this->getMock('Magento\Store\Model\StoreManager', [], [], '', false, false),
$this->getMock('Magento\Eav\Model\Resource\Helper', [], [], '', false, false),
$this->getMock('Magento\Framework\Validator\UniversalFactory', [], [], '', false, false)
diff --git a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ObserverTest.php
index d414cdd6cf901..930c52facbf96 100644
--- a/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ObserverTest.php
+++ b/dev/tests/unit/testsuite/Magento/GoogleShopping/Model/ObserverTest.php
@@ -36,8 +36,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->collectionFactory = $this->getMock('Magento\GoogleShopping\Model\Resource\Item\CollectionFactory');
- $this->massOperationsFactory = $this->getMock('Magento\GoogleShopping\Model\MassOperationsFactory');
+ $this->collectionFactory = $this->getMock(
+ 'Magento\GoogleShopping\Model\Resource\Item\CollectionFactory', [], [], '', false
+ );
+ $this->massOperationsFactory = $this->getMock(
+ 'Magento\GoogleShopping\Model\MassOperationsFactory', [], [], '', false
+ );
$this->notificationInterface = $this->getMock('Magento\Framework\Notification\NotifierInterface');
$this->scopeConfigInterface = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface');
$this->managerInterface = $this->getMock('Magento\Framework\Message\ManagerInterface');
diff --git a/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php b/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php
index 19fb812b7d402..82de98bfa27d4 100644
--- a/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php
+++ b/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php
@@ -28,9 +28,6 @@ class OauthTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Framework\Oauth\Helper\Oauth */
private $_oauthHelperMock;
- /** @var \Magento\Integration\Helper\Oauth\Data */
- private $_dataHelperMock;
-
/** @var \Magento\Framework\Oauth\Oauth */
private $_oauth;
@@ -40,6 +37,11 @@ class OauthTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\Framework\Stdlib\DateTime\DateTime */
private $_dateMock;
+ /**
+ * @var \Psr\Log\LoggerInterface
+ */
+ private $_loggerMock;
+
private $_oauthToken;
private $_oauthSecret;
@@ -105,15 +107,15 @@ public function setUp()
$this->_oauthHelperMock = $this->getMockBuilder('Magento\Framework\Oauth\Helper\Oauth')
->setConstructorArgs([new \Magento\Framework\Math\Random()])
->getMock();
- $this->_dataHelperMock = $this->getMockBuilder(
- 'Magento\Integration\Helper\Oauth\Data'
- )->disableOriginalConstructor()->getMock();
$this->_httpUtilityMock = $this->getMockBuilder('Zend_Oauth_Http_Utility')
->setMethods(['sign'])
->getMock();
$this->_dateMock = $this->getMockBuilder('Magento\Framework\Stdlib\DateTime\DateTime')
->disableOriginalConstructor()
->getMock();
+ $this->_loggerMock = $this->getMockBuilder('Psr\Log\LoggerInterface')
+ ->disableOriginalConstructor()
+ ->getMock();
$nonceGenerator = new \Magento\Integration\Model\Oauth\Nonce\Generator(
$this->_oauthHelperMock,
@@ -123,7 +125,7 @@ public function setUp()
$tokenProvider = new \Magento\Integration\Model\Oauth\Token\Provider(
$this->_consumerFactory,
$this->_tokenFactory,
- $this->_dataHelperMock
+ $this->_loggerMock
);
$this->_oauth = new \Magento\Framework\Oauth\Oauth(
$this->_oauthHelperMock,
@@ -144,7 +146,6 @@ public function tearDown()
unset($this->_nonceFactory);
unset($this->_tokenFactory);
unset($this->_oauthHelperMock);
- unset($this->_dataHelperMock);
unset($this->_httpUtilityMock);
unset($this->_dateMock);
unset($this->_oauth);
diff --git a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
index 34ae088e8928a..ca617c4f218d6 100644
--- a/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
+++ b/dev/tests/unit/testsuite/Magento/Newsletter/Model/TemplateTest.php
@@ -54,7 +54,7 @@ public function testGetProcessedTemplate($isSingleStore)
);
$scopeConfig = $this->getMock('Magento\Framework\App\Config\ScopeConfigInterface');
- $templateFactory = $this->getMock('Magento\Newsletter\Model\TemplateFactory');
+ $templateFactory = $this->getMock('Magento\Newsletter\Model\TemplateFactory', [], [], '', false);
$data = ['template_text' => 'template text'];
$filterManager = $this->getMock('\Magento\Framework\Filter\FilterManager', [], [], '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Review/Model/ReviewTest.php b/dev/tests/unit/testsuite/Magento/Review/Model/ReviewTest.php
index e1386678ab09f..20a385e193ae5 100644
--- a/dev/tests/unit/testsuite/Magento/Review/Model/ReviewTest.php
+++ b/dev/tests/unit/testsuite/Magento/Review/Model/ReviewTest.php
@@ -55,14 +55,32 @@ protected function setUp()
$this->registryMock = $this->getMock('Magento\Framework\Registry');
$this->productFactoryMock = $this->getMock(
'Magento\Review\Model\Resource\Review\Product\CollectionFactory',
- ['create']
+ ['create'],
+ [],
+ '',
+ false
);
$this->statusFactoryMock = $this->getMock(
'Magento\Review\Model\Resource\Review\Status\CollectionFactory',
- ['create']
+ ['create'],
+ [],
+ '',
+ false
+ );
+ $this->reviewSummaryMock = $this->getMock(
+ 'Magento\Review\Model\Resource\Review\Summary\CollectionFactory',
+ [],
+ [],
+ '',
+ false
+ );
+ $this->summaryModMock = $this->getMock(
+ 'Magento\Review\Model\Review\SummaryFactory',
+ ['create'],
+ [],
+ '',
+ false
);
- $this->reviewSummaryMock = $this->getMock('Magento\Review\Model\Resource\Review\Summary\CollectionFactory');
- $this->summaryModMock = $this->getMock('Magento\Review\Model\Review\SummaryFactory', ['create']);
$this->summaryMock = $this->getMock('Magento\Review\Model\Review\Summary', [], [], '', false);
$this->storeManagerMock = $this->getMock('Magento\Store\Model\StoreManagerInterface');
$this->urlInterfaceMock = $this->getMock('Magento\Framework\UrlInterface');
diff --git a/dev/tests/unit/testsuite/Magento/Review/Model/RssTest.php b/dev/tests/unit/testsuite/Magento/Review/Model/RssTest.php
index 9bd10d0ac1321..0c10fed0aaf97 100644
--- a/dev/tests/unit/testsuite/Magento/Review/Model/RssTest.php
+++ b/dev/tests/unit/testsuite/Magento/Review/Model/RssTest.php
@@ -33,7 +33,7 @@ class RssTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
$this->managerInterface = $this->getMock('Magento\Framework\Event\ManagerInterface');
- $this->reviewFactory = $this->getMock('Magento\Review\Model\ReviewFactory', ['create']);
+ $this->reviewFactory = $this->getMock('Magento\Review\Model\ReviewFactory', ['create'], [], '', false);
$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->rss = $this->objectManagerHelper->getObject(
diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Item/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Item/ProcessorTest.php
index 7406cd39d6d7e..d2b2fdfba4df4 100644
--- a/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Item/ProcessorTest.php
+++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Item/ProcessorTest.php
@@ -5,13 +5,13 @@
*/
namespace Magento\Sales\Model\Quote\Item;
-use \Magento\Catalog\Model\Product;
-use \Magento\Sales\Model\Quote\ItemFactory;
-use \Magento\Sales\Model\Quote\Item;
+use Magento\Catalog\Model\Product;
+use Magento\Sales\Model\Quote\ItemFactory;
+use Magento\Sales\Model\Quote\Item;
use Magento\Store\Model\StoreManagerInterface;
-use \Magento\Store\Model\Store;
-use \Magento\Framework\App\State;
-use \Magento\Framework\Object;
+use Magento\Store\Model\Store;
+use Magento\Framework\App\State;
+use Magento\Framework\Object;
/**
* Tests for Magento\Sales\Model\Service\Quote\Processor
diff --git a/dev/tests/unit/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php b/dev/tests/unit/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
index 54427c216a112..5b2cb6669e0f2 100644
--- a/dev/tests/unit/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
+++ b/dev/tests/unit/testsuite/Magento/UrlRewrite/Block/Catalog/Edit/FormTest.php
@@ -32,7 +32,9 @@ protected function setUp()
{
$this->layout = $this->getMock('Magento\Framework\View\LayoutInterface');
$this->formFactory = $this->getMock('Magento\Framework\Data\FormFactory', ['create'], [], '', false);
- $this->urlRewriteFactory = $this->getMock('Magento\UrlRewrite\Model\UrlRewriteFactory', ['create']);
+ $this->urlRewriteFactory = $this->getMock(
+ 'Magento\UrlRewrite\Model\UrlRewriteFactory', ['create'], [], '', false
+ );
$this->urlRewriteFactory->expects($this->once())->method('create')
->willReturn($this->getMock('Magento\UrlRewrite\Model\UrlRewrite', [], [], '', false));
$this->categoryFactory = $this->getMock('Magento\Catalog\Model\CategoryFactory', ['create'], [], '', false);
diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/FactoryTest.php
index 5bb6c5e22619d..cd4d7c866e3b7 100644
--- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/FactoryTest.php
+++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Response/Renderer/FactoryTest.php
@@ -77,7 +77,8 @@ public function testGetWithWrongAcceptHttpHeader()
$this->_factory->get();
$this->fail("Exception is expected to be raised");
} catch (\Magento\Webapi\Exception $e) {
- $exceptionMessage = 'Server cannot understand Accept HTTP header media type.';
+ $exceptionMessage = 'Server cannot match any of the given Accept HTTP header media type(s) '.
+ 'from the request: "" with media types from the config of response renderer.';
$this->assertInstanceOf('Magento\Webapi\Exception', $e, 'Exception type is invalid');
$this->assertEquals($exceptionMessage, $e->getMessage(), 'Exception message is invalid');
$this->assertEquals(
diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ObserverTest.php
index d4cc35f4ba3fc..ec1ea21e83ff9 100644
--- a/dev/tests/unit/testsuite/Magento/Wishlist/Model/ObserverTest.php
+++ b/dev/tests/unit/testsuite/Magento/Wishlist/Model/ObserverTest.php
@@ -69,6 +69,7 @@ public function setUp()
->setMethods(['setWishlistItemCount', 'isLoggedIn', 'getCustomerId'])
->getMock();
$this->wishlistFactory = $this->getMockBuilder('Magento\Wishlist\Model\WishlistFactory')
+ ->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
$this->wishlist = $this->getMockBuilder('Magento\Wishlist\Model\Wishlist')
diff --git a/lib/internal/Magento/Framework/Translate.php b/lib/internal/Magento/Framework/Translate.php
index 8c1273ff99d78..285dc19402892 100644
--- a/lib/internal/Magento/Framework/Translate.php
+++ b/lib/internal/Magento/Framework/Translate.php
@@ -407,11 +407,12 @@ public function getTheme()
/**
* Retrieve cache identifier
*
+ * @param bool $forceReload
* @return string
*/
- protected function getCacheId()
+ protected function getCacheId($forceReload = false)
{
- if ($this->_cacheId === null) {
+ if ($this->_cacheId === null || $forceReload) {
$this->_cacheId = \Magento\Framework\App\Cache\Type\Translate::TYPE_IDENTIFIER;
if (isset($this->_config['locale'])) {
$this->_cacheId .= '_' . $this->_config['locale'];
@@ -450,7 +451,7 @@ protected function _loadCache()
*/
protected function _saveCache()
{
- $this->_cache->save(serialize($this->getData()), $this->getCacheId(), [], false);
+ $this->_cache->save(serialize($this->getData()), $this->getCacheId(true), [], false);
return $this;
}
}
diff --git a/lib/internal/Magento/Framework/View/Element/Messages.php b/lib/internal/Magento/Framework/View/Element/Messages.php
index 429e451e81aae..72ffa54aa2dcd 100644
--- a/lib/internal/Magento/Framework/View/Element/Messages.php
+++ b/lib/internal/Magento/Framework/View/Element/Messages.php
@@ -283,7 +283,7 @@ protected function _renderMessagesByType()
foreach ($messages as $message) {
$html .= '<' . $this->secondLevelTagName . ' class="message ' . $type . '">';
$html .= '<' . $this->contentWrapTagName . $this->getUiId('message', $type) . '>';
- $html .= $message->getText();
+ $html .= $this->_escaper->escapeHtml($message->getText());
$html .= '' . $this->contentWrapTagName . '>';
$html .= '' . $this->secondLevelTagName . '>';
}