diff --git a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml
index 83808df5b95e4..3f616ab791dfe 100644
--- a/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml
+++ b/app/code/Magento/CatalogSearch/view/frontend/templates/advanced/result.phtml
@@ -11,6 +11,8 @@
/**
* @var $block \Magento\CatalogSearch\Block\Advanced\Result
*/
+/** this changes need for valid apply filters and configuration before search process is started */
+$productList = $block->getProductListHtml();
?>
getResultCount()): ?>
@@ -49,6 +51,6 @@
getResultCount()): ?>
- = $block->getProductListHtml() ?>
+ = /* @escapeNotVerified */ $productList ?>
getSearchCriterias(); ?>
diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php b/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
index 9aaa384776855..7b60c85049767 100644
--- a/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
+++ b/app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php
@@ -263,6 +263,7 @@ protected function _populateForUrlGeneration($rowData)
if ($this->isGlobalScope($product->getStoreId())) {
$this->populateGlobalProduct($product);
} else {
+ $this->storesCache[$product->getStoreId()] = true;
$this->addProductToImport($product, $product->getStoreId());
}
return $this;
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
index 6f9a1a46826da..d68b0682eb511 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js
@@ -202,6 +202,13 @@ function (
}
},
+ /**
+ * Manage cancel button visibility
+ */
+ canUseCancelBillingAddress: ko.computed(function () {
+ return quote.billingAddress() || lastSelectedBillingAddress;
+ }),
+
/**
* Restore billing address
*/
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
index 5f735fbb4daa9..63edb5057b933 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address.html
@@ -22,7 +22,7 @@
-
+
+
+
+
+
+
+ This element contains invalid data. Please resolve this before saving.
+
+
+
+
diff --git a/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php b/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php
index 2ec573b6459da..e1bb094e7fc39 100644
--- a/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php
+++ b/app/code/Magento/UrlRewrite/Model/StoreSwitcher/RewriteUrl.php
@@ -81,7 +81,12 @@ public function switch(StoreInterface $fromStore, StoreInterface $targetStore, s
$existingRewrite = $this->urlFinder->findOneByData([
UrlRewrite::REQUEST_PATH => $urlPath
]);
- if ($existingRewrite) {
+ $currentRewrite = $this->urlFinder->findOneByData([
+ UrlRewrite::REQUEST_PATH => $urlPath,
+ UrlRewrite::STORE_ID => $targetStore->getId(),
+ ]);
+
+ if ($existingRewrite && !$currentRewrite) {
/** @var \Magento\Framework\App\Response\Http $response */
$targetUrl = $targetStore->getBaseUrl();
}
diff --git a/app/code/Magento/Wishlist/Controller/Index/Allcart.php b/app/code/Magento/Wishlist/Controller/Index/Allcart.php
index 8463a00c866c5..958e0f49ca1b6 100644
--- a/app/code/Magento/Wishlist/Controller/Index/Allcart.php
+++ b/app/code/Magento/Wishlist/Controller/Index/Allcart.php
@@ -5,14 +5,17 @@
*/
namespace Magento\Wishlist\Controller\Index;
+use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Data\Form\FormKey\Validator;
-use Magento\Framework\App\Action;
use Magento\Framework\App\Action\Context;
use Magento\Wishlist\Controller\WishlistProviderInterface;
use Magento\Wishlist\Model\ItemCarrier;
use Magento\Framework\Controller\ResultFactory;
-class Allcart extends \Magento\Wishlist\Controller\AbstractIndex
+/**
+ * Action Add All to Cart
+ */
+class Allcart extends \Magento\Wishlist\Controller\AbstractIndex implements HttpPostActionInterface
{
/**
* @var WishlistProviderInterface
diff --git a/composer.lock b/composer.lock
index 84e89277a95db..72d3e93a7b35e 100644
--- a/composer.lock
+++ b/composer.lock
@@ -257,16 +257,16 @@
},
{
"name": "composer/composer",
- "version": "1.8.3",
+ "version": "1.8.4",
"source": {
"type": "git",
"url": "https://github.com/composer/composer.git",
- "reference": "a6a3b44581398b7135c7baa0557b7c5b10808b47"
+ "reference": "bc364c2480c17941e2135cfc568fa41794392534"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/composer/zipball/a6a3b44581398b7135c7baa0557b7c5b10808b47",
- "reference": "a6a3b44581398b7135c7baa0557b7c5b10808b47",
+ "url": "https://api.github.com/repos/composer/composer/zipball/bc364c2480c17941e2135cfc568fa41794392534",
+ "reference": "bc364c2480c17941e2135cfc568fa41794392534",
"shasum": ""
},
"require": {
@@ -333,7 +333,7 @@
"dependency",
"package"
],
- "time": "2019-01-30T07:31:34+00:00"
+ "time": "2019-02-11T09:52:10+00:00"
},
{
"name": "composer/semver",
@@ -1912,7 +1912,7 @@
},
{
"name": "symfony/css-selector",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -2028,16 +2028,16 @@
},
{
"name": "symfony/filesystem",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee"
+ "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/7c16ebc2629827d4ec915a52ac809768d060a4ee",
- "reference": "7c16ebc2629827d4ec915a52ac809768d060a4ee",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/e16b9e471703b2c60b95f14d31c1239f68f11601",
+ "reference": "e16b9e471703b2c60b95f14d31c1239f68f11601",
"shasum": ""
},
"require": {
@@ -2074,20 +2074,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2019-01-16T20:35:37+00:00"
+ "time": "2019-02-07T11:40:08+00:00"
},
{
"name": "symfony/finder",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c"
+ "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/ef71816cbb264988bb57fe6a73f610888b9aa70c",
- "reference": "ef71816cbb264988bb57fe6a73f610888b9aa70c",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/267b7002c1b70ea80db0833c3afe05f0fbde580a",
+ "reference": "267b7002c1b70ea80db0833c3afe05f0fbde580a",
"shasum": ""
},
"require": {
@@ -2123,7 +2123,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2019-01-16T20:35:37+00:00"
+ "time": "2019-02-23T15:42:05+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -2753,16 +2753,16 @@
},
{
"name": "zendframework/zend-db",
- "version": "2.9.3",
+ "version": "2.10.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-db.git",
- "reference": "5b4f2c42f94c9f7f4b2f456a0ebe459fab12b3d9"
+ "reference": "77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-db/zipball/5b4f2c42f94c9f7f4b2f456a0ebe459fab12b3d9",
- "reference": "5b4f2c42f94c9f7f4b2f456a0ebe459fab12b3d9",
+ "url": "https://api.github.com/repos/zendframework/zend-db/zipball/77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e",
+ "reference": "77022f06f6ffd384fa86d22ab8d8bbdb925a1e8e",
"shasum": ""
},
"require": {
@@ -2773,7 +2773,7 @@
"phpunit/phpunit": "^5.7.25 || ^6.4.4",
"zendframework/zend-coding-standard": "~1.0.0",
"zendframework/zend-eventmanager": "^2.6.2 || ^3.0",
- "zendframework/zend-hydrator": "^1.1 || ^2.1",
+ "zendframework/zend-hydrator": "^1.1 || ^2.1 || ^3.0",
"zendframework/zend-servicemanager": "^2.7.5 || ^3.0.3"
},
"suggest": {
@@ -2807,7 +2807,7 @@
"db",
"zf"
],
- "time": "2018-04-09T13:21:36+00:00"
+ "time": "2019-02-25T11:37:45+00:00"
},
{
"name": "zendframework/zend-di",
@@ -4377,16 +4377,16 @@
},
{
"name": "zendframework/zend-uri",
- "version": "2.6.1",
+ "version": "2.7.0",
"source": {
"type": "git",
"url": "https://github.com/zendframework/zend-uri.git",
- "reference": "3b6463645c6766f78ce537c70cb4fdabee1e725f"
+ "reference": "b2785cd38fe379a784645449db86f21b7739b1ee"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/3b6463645c6766f78ce537c70cb4fdabee1e725f",
- "reference": "3b6463645c6766f78ce537c70cb4fdabee1e725f",
+ "url": "https://api.github.com/repos/zendframework/zend-uri/zipball/b2785cd38fe379a784645449db86f21b7739b1ee",
+ "reference": "b2785cd38fe379a784645449db86f21b7739b1ee",
"shasum": ""
},
"require": {
@@ -4401,8 +4401,8 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "2.6.x-dev",
- "dev-develop": "2.7.x-dev"
+ "dev-master": "2.7.x-dev",
+ "dev-develop": "2.8.x-dev"
}
},
"autoload": {
@@ -4420,7 +4420,7 @@
"uri",
"zf"
],
- "time": "2018-04-30T13:40:08+00:00"
+ "time": "2019-02-27T21:39:04+00:00"
},
{
"name": "zendframework/zend-validator",
@@ -4889,16 +4889,16 @@
},
{
"name": "codeception/phpunit-wrapper",
- "version": "6.5.1",
+ "version": "6.6.1",
"source": {
"type": "git",
"url": "https://github.com/Codeception/phpunit-wrapper.git",
- "reference": "d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3"
+ "reference": "d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3",
- "reference": "d78f9eb9c4300a5924cc27dee03e8c1a96fcf5f3",
+ "url": "https://api.github.com/repos/Codeception/phpunit-wrapper/zipball/d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c",
+ "reference": "d0da25a98bcebeb15d97c2ad3b2de6166b6e7a0c",
"shasum": ""
},
"require": {
@@ -4912,7 +4912,7 @@
},
"require-dev": {
"codeception/specify": "*",
- "vlucas/phpdotenv": "^2.4"
+ "vlucas/phpdotenv": "^3.0"
},
"type": "library",
"autoload": {
@@ -4931,24 +4931,24 @@
}
],
"description": "PHPUnit classes used by Codeception",
- "time": "2019-01-13T10:34:55+00:00"
+ "time": "2019-02-26T20:47:39+00:00"
},
{
"name": "codeception/stub",
- "version": "2.0.4",
+ "version": "2.1.0",
"source": {
"type": "git",
"url": "https://github.com/Codeception/Stub.git",
- "reference": "f50bc271f392a2836ff80690ce0c058efe1ae03e"
+ "reference": "853657f988942f7afb69becf3fd0059f192c705a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeception/Stub/zipball/f50bc271f392a2836ff80690ce0c058efe1ae03e",
- "reference": "f50bc271f392a2836ff80690ce0c058efe1ae03e",
+ "url": "https://api.github.com/repos/Codeception/Stub/zipball/853657f988942f7afb69becf3fd0059f192c705a",
+ "reference": "853657f988942f7afb69becf3fd0059f192c705a",
"shasum": ""
},
"require": {
- "phpunit/phpunit": ">=4.8 <8.0"
+ "codeception/phpunit-wrapper": ">6.0.15 <6.1.0 | ^6.6.1 | ^7.7.1 | ^8.0.3"
},
"type": "library",
"autoload": {
@@ -4961,7 +4961,7 @@
"MIT"
],
"description": "Flexible Stub wrapper for PHPUnit's Mock Builder",
- "time": "2018-07-26T11:55:37+00:00"
+ "time": "2019-03-02T15:35:10+00:00"
},
{
"name": "consolidation/annotated-command",
@@ -5061,16 +5061,16 @@
},
{
"name": "consolidation/config",
- "version": "1.1.1",
+ "version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/consolidation/config.git",
- "reference": "925231dfff32f05b787e1fddb265e789b939cf4c"
+ "reference": "cac1279bae7efb5c7fb2ca4c3ba4b8eb741a96c1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/config/zipball/925231dfff32f05b787e1fddb265e789b939cf4c",
- "reference": "925231dfff32f05b787e1fddb265e789b939cf4c",
+ "url": "https://api.github.com/repos/consolidation/config/zipball/cac1279bae7efb5c7fb2ca4c3ba4b8eb741a96c1",
+ "reference": "cac1279bae7efb5c7fb2ca4c3ba4b8eb741a96c1",
"shasum": ""
},
"require": {
@@ -5079,9 +5079,9 @@
"php": ">=5.4.0"
},
"require-dev": {
- "g1a/composer-test-scenarios": "^1",
+ "g1a/composer-test-scenarios": "^3",
+ "php-coveralls/php-coveralls": "^1",
"phpunit/phpunit": "^5",
- "satooshi/php-coveralls": "^1.0",
"squizlabs/php_codesniffer": "2.*",
"symfony/console": "^2.5|^3|^4",
"symfony/yaml": "^2.8.11|^3|^4"
@@ -5091,6 +5091,33 @@
},
"type": "library",
"extra": {
+ "scenarios": {
+ "symfony4": {
+ "require-dev": {
+ "symfony/console": "^4.0"
+ },
+ "config": {
+ "platform": {
+ "php": "7.1.3"
+ }
+ }
+ },
+ "symfony2": {
+ "require-dev": {
+ "symfony/console": "^2.8",
+ "symfony/event-dispatcher": "^2.8",
+ "phpunit/phpunit": "^4.8.36"
+ },
+ "remove": [
+ "php-coveralls/php-coveralls"
+ ],
+ "config": {
+ "platform": {
+ "php": "5.4.8"
+ }
+ }
+ }
+ },
"branch-alias": {
"dev-master": "1.x-dev"
}
@@ -5111,7 +5138,7 @@
}
],
"description": "Provide configuration services for a commandline tool.",
- "time": "2018-10-24T17:55:35+00:00"
+ "time": "2019-03-03T19:37:04+00:00"
},
{
"name": "consolidation/log",
@@ -5261,16 +5288,16 @@
},
{
"name": "consolidation/robo",
- "version": "1.4.4",
+ "version": "1.4.6",
"source": {
"type": "git",
"url": "https://github.com/consolidation/Robo.git",
- "reference": "8bec6a6ea54a7d03d56552a4250c49dec3b3083d"
+ "reference": "d4805a1abbc730e9a6d64ede2eba56f91a2b4eb3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/Robo/zipball/8bec6a6ea54a7d03d56552a4250c49dec3b3083d",
- "reference": "8bec6a6ea54a7d03d56552a4250c49dec3b3083d",
+ "url": "https://api.github.com/repos/consolidation/Robo/zipball/d4805a1abbc730e9a6d64ede2eba56f91a2b4eb3",
+ "reference": "d4805a1abbc730e9a6d64ede2eba56f91a2b4eb3",
"shasum": ""
},
"require": {
@@ -5365,7 +5392,7 @@
}
],
"description": "Modern task runner",
- "time": "2019-02-08T20:59:23+00:00"
+ "time": "2019-02-17T05:32:27+00:00"
},
{
"name": "consolidation/self-update",
@@ -7815,7 +7842,6 @@
"mock",
"xunit"
],
- "abandoned": true,
"time": "2018-08-09T05:50:03+00:00"
},
{
@@ -8559,16 +8585,16 @@
},
{
"name": "symfony/browser-kit",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
- "reference": "ee4462581eb54bf34b746e4a5d522a4f21620160"
+ "reference": "61d85c5af2fc058014c7c89504c3944e73a086f0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/browser-kit/zipball/ee4462581eb54bf34b746e4a5d522a4f21620160",
- "reference": "ee4462581eb54bf34b746e4a5d522a4f21620160",
+ "url": "https://api.github.com/repos/symfony/browser-kit/zipball/61d85c5af2fc058014c7c89504c3944e73a086f0",
+ "reference": "61d85c5af2fc058014c7c89504c3944e73a086f0",
"shasum": ""
},
"require": {
@@ -8612,20 +8638,20 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com",
- "time": "2019-01-16T21:31:25+00:00"
+ "time": "2019-02-23T15:17:42+00:00"
},
{
"name": "symfony/config",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "25a2e7abe0d97e70282537292e3df45cf6da7b98"
+ "reference": "7f70d79c7a24a94f8e98abb988049403a53d7b31"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/25a2e7abe0d97e70282537292e3df45cf6da7b98",
- "reference": "25a2e7abe0d97e70282537292e3df45cf6da7b98",
+ "url": "https://api.github.com/repos/symfony/config/zipball/7f70d79c7a24a94f8e98abb988049403a53d7b31",
+ "reference": "7f70d79c7a24a94f8e98abb988049403a53d7b31",
"shasum": ""
},
"require": {
@@ -8675,7 +8701,7 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2019-01-30T11:44:30+00:00"
+ "time": "2019-02-23T15:17:42+00:00"
},
{
"name": "symfony/contracts",
@@ -8747,16 +8773,16 @@
},
{
"name": "symfony/dependency-injection",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
- "reference": "72c14cbc0c27706b9b4c33b9cd7a280972ff4806"
+ "reference": "cdadb3765df7c89ac93628743913b92bb91f1704"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/72c14cbc0c27706b9b4c33b9cd7a280972ff4806",
- "reference": "72c14cbc0c27706b9b4c33b9cd7a280972ff4806",
+ "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/cdadb3765df7c89ac93628743913b92bb91f1704",
+ "reference": "cdadb3765df7c89ac93628743913b92bb91f1704",
"shasum": ""
},
"require": {
@@ -8816,20 +8842,20 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com",
- "time": "2019-01-30T17:51:38+00:00"
+ "time": "2019-02-23T15:17:42+00:00"
},
{
"name": "symfony/dom-crawler",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
- "reference": "d8476760b04cdf7b499c8718aa437c20a9155103"
+ "reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/d8476760b04cdf7b499c8718aa437c20a9155103",
- "reference": "d8476760b04cdf7b499c8718aa437c20a9155103",
+ "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/53c97769814c80a84a8403efcf3ae7ae966d53bb",
+ "reference": "53c97769814c80a84a8403efcf3ae7ae966d53bb",
"shasum": ""
},
"require": {
@@ -8873,20 +8899,20 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com",
- "time": "2019-01-16T20:35:37+00:00"
+ "time": "2019-02-23T15:17:42+00:00"
},
{
"name": "symfony/http-foundation",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39"
+ "reference": "850a667d6254ccf6c61d853407b16f21c4579c77"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
- "reference": "8d2318b73e0a1bc75baa699d00ebe2ae8b595a39",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/850a667d6254ccf6c61d853407b16f21c4579c77",
+ "reference": "850a667d6254ccf6c61d853407b16f21c4579c77",
"shasum": ""
},
"require": {
@@ -8927,20 +8953,20 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
- "time": "2019-01-29T09:49:29+00:00"
+ "time": "2019-02-26T08:03:39+00:00"
},
{
"name": "symfony/options-resolver",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
- "reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb"
+ "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/options-resolver/zipball/831b272963a8aa5a0613a1a7f013322d8161bbbb",
- "reference": "831b272963a8aa5a0613a1a7f013322d8161bbbb",
+ "url": "https://api.github.com/repos/symfony/options-resolver/zipball/3896e5a7d06fd15fa4947694c8dcdd371ff147d1",
+ "reference": "3896e5a7d06fd15fa4947694c8dcdd371ff147d1",
"shasum": ""
},
"require": {
@@ -8981,7 +9007,7 @@
"configuration",
"options"
],
- "time": "2019-01-16T21:31:25+00:00"
+ "time": "2019-02-23T15:17:42+00:00"
},
{
"name": "symfony/polyfill-php70",
@@ -9099,7 +9125,7 @@
},
{
"name": "symfony/stopwatch",
- "version": "v4.2.3",
+ "version": "v4.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
@@ -9149,16 +9175,16 @@
},
{
"name": "symfony/yaml",
- "version": "v3.4.22",
+ "version": "v3.4.23",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "ba11776e9e6c15ad5759a07bffb15899bac75c2d"
+ "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/ba11776e9e6c15ad5759a07bffb15899bac75c2d",
- "reference": "ba11776e9e6c15ad5759a07bffb15899bac75c2d",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/57f1ce82c997f5a8701b89ef970e36bb657fd09c",
+ "reference": "57f1ce82c997f5a8701b89ef970e36bb657fd09c",
"shasum": ""
},
"require": {
@@ -9204,7 +9230,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2019-01-16T10:59:17+00:00"
+ "time": "2019-02-23T15:06:07+00:00"
},
{
"name": "theseer/fdomdocument",
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php
index a7c83aba89f0a..e517b22ad09de 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductViewTest.php
@@ -137,6 +137,26 @@ public function testQueryAllFieldsSimpleProduct()
sort_order
}
}
+ ... on CustomizableCheckboxOption {
+ checkbox_option: value {
+ option_type_id
+ sku
+ price
+ price_type
+ title
+ sort_order
+ }
+ }
+ ... on CustomizableMultipleOption {
+ multiple_option: value {
+ option_type_id
+ sku
+ price
+ price_type
+ title
+ sort_order
+ }
+ }
...on CustomizableFileOption {
product_sku
file_option: value {
@@ -736,7 +756,7 @@ private function assertOptions($product, $actualResponse)
$values = $option->getValues();
/** @var \Magento\Catalog\Model\Product\Option\Value $value */
$value = current($values);
- $findValueKeyName = $option->getType() === 'radio' ? 'radio_option' : 'drop_down_option';
+ $findValueKeyName = $option->getType() . '_option';
if ($value->getTitle() === $optionsArray[$findValueKeyName][0]['title']) {
$match = true;
}
@@ -756,7 +776,7 @@ private function assertOptions($product, $actualResponse)
];
if (!empty($option->getValues())) {
- $valueKeyName = $option->getType() === 'radio' ? 'radio_option' : 'drop_down_option';
+ $valueKeyName = $option->getType() . '_option';
$value = current($optionsArray[$valueKeyName]);
/** @var \Magento\Catalog\Model\Product\Option\Value $productValue */
$productValue = current($option->getValues());
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
new file mode 100644
index 0000000000000..17c2af8dc59d0
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/CatalogInventory/AddProductToCartTest.php
@@ -0,0 +1,124 @@
+quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Catalog/_files/products.php
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
+ * @expectedException \Exception
+ * @expectedExceptionMessage The requested qty is not available
+ */
+ public function testAddProductIfQuantityIsNotAvailable()
+ {
+ $sku = 'simple';
+ $qty = 200;
+
+ $maskedQuoteId = $this->getMaskedQuoteId();
+ $query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
+ $this->graphQlQuery($query);
+ self::fail('Should be "The requested qty is not available" error message.');
+ }
+
+ /**
+ * @magentoApiDataFixture Magento/Catalog/_files/products.php
+ * @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
+ * @magentoConfigFixture default cataloginventory/item_options/max_sale_qty 5
+ * @expectedException \Exception
+ * @expectedExceptionMessage The most you may purchase is 5.
+ */
+ public function testAddMoreProductsThatAllowed()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/167');
+
+ $sku = 'custom-design-simple-product';
+ $qty = 7;
+
+ $maskedQuoteId = $this->getMaskedQuoteId();
+ $query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
+ $this->graphQlQuery($query);
+ self::fail('Should be "The most you may purchase is 5." error message.');
+ }
+
+ /**
+ * @return string
+ */
+ public function getMaskedQuoteId() : string
+ {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+
+ return $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $sku
+ * @param int $qty
+ * @return string
+ */
+ public function getAddSimpleProductQuery(string $maskedQuoteId, string $sku, int $qty) : string
+ {
+ return <<quoteResource = $objectManager->get(QuoteResource::class);
- $this->quote = $objectManager->create(Quote::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
$this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
}
/**
* @magentoApiDataFixture Magento/Catalog/_files/products.php
* @magentoApiDataFixture Magento/Checkout/_files/active_quote.php
- * @expectedException \Exception
- * @expectedExceptionMessage The requested qty is not available
*/
- public function testAddProductIfQuantityIsNotAvailable()
+ public function testAddSimpleProductToCart()
{
$sku = 'simple';
- $qty = 200;
+ $qty = 2;
+ $maskedQuoteId = $this->getMaskedQuoteId();
- $this->quoteResource->load(
- $this->quote,
- 'test_order_1',
- 'reserved_order_id'
- );
- $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$this->quote->getId());
+ $query = $this->getAddSimpleProductQuery($maskedQuoteId, $sku, $qty);
+ $response = $this->graphQlQuery($query);
+ self::assertArrayHasKey('cart', $response['addSimpleProductsToCart']);
- $query = <<quoteFactory->create();
+ $this->quoteResource->load($quote, 'test_order_1', 'reserved_order_id');
+
+ return $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $sku
+ * @param int $qty
+ * @return string
+ */
+ public function getAddSimpleProductQuery(string $maskedQuoteId, string $sku, int $qty): string
+ {
+ return <<graphQlQuery($query);
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php
index 96f32d781267b..1a93c011e80a8 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetBillingAddressOnCartTest.php
@@ -90,6 +90,7 @@ public function testSetNewBillingAddress()
code
label
}
+ address_type
}
}
}
@@ -147,6 +148,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
code
label
}
+ address_type
}
shipping_addresses {
firstname
@@ -160,6 +162,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
code
label
}
+ address_type
}
}
}
@@ -174,7 +177,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
self::assertArrayHasKey('shipping_addresses', $cartResponse);
$shippingAddressResponse = current($cartResponse['shipping_addresses']);
$this->assertNewAddressFields($billingAddressResponse);
- $this->assertNewAddressFields($shippingAddressResponse);
+ $this->assertNewAddressFields($shippingAddressResponse, 'SHIPPING');
}
/**
@@ -403,9 +406,10 @@ public function testSetBillingAddressIfCustomerIsNotOwnerOfAddress()
/**
* Verify the all the whitelisted fields for a New Address Object
*
- * @param array $billingAddressResponse
+ * @param array $addressResponse
+ * @param string $addressType
*/
- private function assertNewAddressFields(array $billingAddressResponse): void
+ private function assertNewAddressFields(array $addressResponse, string $addressType = 'BILLING'): void
{
$assertionMap = [
['response_field' => 'firstname', 'expected_value' => 'test firstname'],
@@ -416,9 +420,10 @@ private function assertNewAddressFields(array $billingAddressResponse): void
['response_field' => 'postcode', 'expected_value' => '887766'],
['response_field' => 'telephone', 'expected_value' => '88776655'],
['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']],
+ ['response_field' => 'address_type', 'expected_value' => $addressType]
];
- $this->assertResponseFields($billingAddressResponse, $assertionMap);
+ $this->assertResponseFields($addressResponse, $assertionMap);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php
new file mode 100644
index 0000000000000..736ea69440753
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Customer/SetShippingMethodsOnCartTest.php
@@ -0,0 +1,206 @@
+quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
+ $this->customerTokenService = $objectManager->get(CustomerTokenServiceInterface::class);
+ }
+
+ public function testShippingMethodWithVirtualProduct()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testShippingMethodWithSimpleProduct()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testShippingMethodWithSimpleProductWithoutAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodWithMissedRequiredParameters()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetNonExistentShippingMethod()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodIfAddressIsNotBelongToCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToNonExistentCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToGuestCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToAnotherCustomerCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToNonExistentCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToGuestCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetShippingMethodToAnotherCustomerCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ public function testSetMultipleShippingMethods()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/423');
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $shippingMethodCode
+ * @param string $shippingCarrierCode
+ * @param string $shippingAddressId
+ * @return string
+ * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
+ */
+ private function prepareMutationQuery(
+ string $maskedQuoteId,
+ string $shippingMethodCode,
+ string $shippingCarrierCode,
+ string $shippingAddressId
+ ) : string {
+ return <<quoteFactory->create();
+ $this->quoteResource->load($quote, $reversedQuoteId, 'reserved_order_id');
+
+ return $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ }
+
+ /**
+ * @param string $reversedQuoteId
+ * @param int $customerId
+ * @return string
+ * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
+ */
+ private function assignQuoteToCustomer(
+ string $reversedQuoteId,
+ int $customerId
+ ): string {
+ $quote = $this->quoteFactory->create();
+ $this->quoteResource->load($quote, $reversedQuoteId, 'reserved_order_id');
+ $quote->setCustomerId($customerId);
+ $this->quoteResource->save($quote);
+ return $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ }
+
+ /**
+ * @param string $username
+ * @param string $password
+ * @return array
+ * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
+ */
+ private function getHeaderMap(string $username = 'customer@example.com', string $password = 'password'): array
+ {
+ $customerToken = $this->customerTokenService->createCustomerAccessToken($username, $password);
+ $headerMap = ['Authorization' => 'Bearer ' . $customerToken];
+ return $headerMap;
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php
index 24fc8353d2552..880d6aa0f406f 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetBillingAddressOnCartTest.php
@@ -82,6 +82,7 @@ public function testSetNewBillingAddress()
code
label
}
+ address_type
}
}
}
@@ -138,6 +139,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
code
label
}
+ address_type
}
shipping_addresses {
firstname
@@ -151,6 +153,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
code
label
}
+ address_type
}
}
}
@@ -165,7 +168,7 @@ public function testSetNewBillingAddressWithUseForShippingParameter()
self::assertArrayHasKey('shipping_addresses', $cartResponse);
$shippingAddressResponse = current($cartResponse['shipping_addresses']);
$this->assertNewAddressFields($billingAddressResponse);
- $this->assertNewAddressFields($shippingAddressResponse);
+ $this->assertNewAddressFields($shippingAddressResponse, 'SHIPPING');
}
/**
@@ -244,9 +247,10 @@ public function testSetBillingAddressFromAddressBook()
/**
* Verify the all the whitelisted fields for a New Address Object
*
- * @param array $billingAddressResponse
+ * @param array $addressResponse
+ * @param string $addressType
*/
- private function assertNewAddressFields(array $billingAddressResponse): void
+ private function assertNewAddressFields(array $addressResponse, string $addressType = 'BILLING'): void
{
$assertionMap = [
['response_field' => 'firstname', 'expected_value' => 'test firstname'],
@@ -257,9 +261,10 @@ private function assertNewAddressFields(array $billingAddressResponse): void
['response_field' => 'postcode', 'expected_value' => '887766'],
['response_field' => 'telephone', 'expected_value' => '88776655'],
['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']],
+ ['response_field' => 'address_type', 'expected_value' => $addressType]
];
- $this->assertResponseFields($billingAddressResponse, $assertionMap);
+ $this->assertResponseFields($addressResponse, $assertionMap);
}
/**
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php
new file mode 100644
index 0000000000000..f159cb6f6151e
--- /dev/null
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/Guest/SetShippingMethodsOnCartTest.php
@@ -0,0 +1,167 @@
+quoteResource = $objectManager->get(QuoteResource::class);
+ $this->quoteFactory = $objectManager->get(QuoteFactory::class);
+ $this->quoteIdToMaskedId = $objectManager->get(QuoteIdToMaskedQuoteIdInterface::class);
+ }
+
+ public function testShippingMethodWithVirtualProduct()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testShippingMethodWithSimpleProduct()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testShippingMethodWithSimpleProductWithoutAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodWithMissedRequiredParameters()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetNonExistentShippingMethod()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodIfAddressIsNotBelongToCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToNonExistentCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToGuestCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToAnotherCustomerCart()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToNonExistentCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToGuestCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetShippingMethodToAnotherCustomerCartAddress()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ public function testSetMultipleShippingMethods()
+ {
+ $this->markTestIncomplete('https://github.com/magento/graphql-ce/issues/422');
+ }
+
+ /**
+ * @param string $maskedQuoteId
+ * @param string $shippingMethodCode
+ * @param string $shippingCarrierCode
+ * @param string $shippingAddressId
+ * @return string
+ * @SuppressWarnings(PHPMD.UnusedPrivateMethod)
+ */
+ private function prepareMutationQuery(
+ string $maskedQuoteId,
+ string $shippingMethodCode,
+ string $shippingCarrierCode,
+ string $shippingAddressId
+ ) : string {
+ return <<quoteFactory->create();
+ $this->quoteResource->load($quote, $reversedQuoteId, 'reserved_order_id');
+
+ return $this->quoteIdToMaskedId->execute((int)$quote->getId());
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php
index 1f9aca2f12013..4916bb2aa78c3 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Quote/SetShippingAddressOnCartTest.php
@@ -94,6 +94,7 @@ public function testSetNewShippingAddressByGuest()
code
label
}
+ address_type
}
}
}
@@ -184,6 +185,7 @@ public function testSetNewShippingAddressByRegisteredCustomer()
label
code
}
+ address_type
}
}
}
@@ -472,6 +474,7 @@ private function assertNewShippingAddressFields(array $shippingAddressResponse):
['response_field' => 'postcode', 'expected_value' => '887766'],
['response_field' => 'telephone', 'expected_value' => '88776655'],
['response_field' => 'country', 'expected_value' => ['code' => 'US', 'label' => 'US']],
+ ['response_field' => 'address_type', 'expected_value' => 'SHIPPING']
];
$this->assertResponseFields($shippingAddressResponse, $assertionMap);
diff --git a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml
index 586ad2acee203..4995c1feb048e 100644
--- a/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml
+++ b/dev/tests/functional/tests/app/Magento/SalesRule/Test/TestCase/CreateSalesRuleEntityTest.xml
@@ -75,7 +75,6 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit - %isolation%
Fixed amount discount for whole cart
60
- No
No
Coupon code+Fixed amount discount for whole cart
simple_for_salesrule_1
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
index 5721982ab8dc3..d4926e78040d6 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php
@@ -38,8 +38,7 @@ public function testGetProductCollection()
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
$collection = $this->_model->getProductCollection();
$this->assertInstanceOf(\Magento\Catalog\Model\ResourceModel\Product\Collection::class, $collection);
- $ids = $collection->getAllIds();
- $this->assertEquals(2, count($ids));
+ $this->assertEquals(2, $collection->count());
$this->assertSame($collection, $this->_model->getProductCollection());
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_full_option_set.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_full_option_set.php
index bd5dc541a15a5..5facba07d58f1 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_full_option_set.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_full_option_set.php
@@ -187,6 +187,50 @@
'price_type' => 'percent',
'sku' => 'sku2',
'max_characters' => 20,
+ ],
+ [
+ 'title' => 'multiple option',
+ 'type' => 'multiple',
+ 'is_require' => true,
+ 'sort_order' => 7,
+ 'values' => [
+ [
+ 'title' => 'multiple option 1',
+ 'price' => 10,
+ 'price_type' => 'fixed',
+ 'sku' => 'multiple option 1 sku',
+ 'sort_order' => 1,
+ ],
+ [
+ 'title' => 'multiple option 2',
+ 'price' => 20,
+ 'price_type' => 'fixed',
+ 'sku' => 'multiple option 2 sku',
+ 'sort_order' => 2,
+ ],
+ ],
+ ],
+ [
+ 'title' => 'checkbox option',
+ 'type' => 'checkbox',
+ 'is_require' => true,
+ 'sort_order' => 6,
+ 'values' => [
+ [
+ 'title' => 'checkbox option 1',
+ 'price' => 10,
+ 'price_type' => 'fixed',
+ 'sku' => 'checkbox option 1 sku',
+ 'sort_order' => 1,
+ ],
+ [
+ 'title' => 'checkbox option 2',
+ 'price' => 20,
+ 'price_type' => 'fixed',
+ 'sku' => 'checkbox option 2 sku',
+ 'sort_order' => 2,
+ ],
+ ],
]
];
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods.php
new file mode 100644
index 0000000000000..dd48975aa2b09
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods.php
@@ -0,0 +1,26 @@
+create(WriterInterface::class);
+
+$configWriter->save('carriers/flatrate/active', 1);
+$configWriter->save('carriers/tablerate/active', 1);
+$configWriter->save('carriers/freeshipping/active', 1);
+$configWriter->save('carriers/ups/active', 1);
+$configWriter->save('carriers/usps/active', 1);
+$configWriter->save('carriers/fedex/active', 1);
+$configWriter->save('carriers/dhl/active', 1);
+
+$scopeConfig = $objectManager->get(ScopeConfigInterface::class);
+$scopeConfig->clean();
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods_rollback.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods_rollback.php
new file mode 100644
index 0000000000000..7a3ca79febf6d
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/enable_all_shipping_methods_rollback.php
@@ -0,0 +1,22 @@
+create(WriterInterface::class);
+
+$configWriter->delete('carriers/flatrate/active');
+$configWriter->delete('carriers/tablerate/active');
+$configWriter->delete('carriers/freeshipping/active');
+$configWriter->delete('carriers/ups/active');
+$configWriter->delete('carriers/usps/active');
+$configWriter->delete('carriers/fedex/active');
+$configWriter->delete('carriers/dhl/active');
diff --git a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProductsTest.php b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProductsTest.php
index 234f0aae6a3ea..676433c0a1e6c 100644
--- a/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProductsTest.php
+++ b/dev/tests/integration/testsuite/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProductsTest.php
@@ -5,7 +5,19 @@
*/
namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\Data;
-class AssociatedProductsTest extends \PHPUnit\Framework\TestCase
+use Magento\Framework\View\Element\UiComponentFactory;
+use Magento\Ui\Component\Filters\FilterModifier;
+use Magento\Framework\View\Element\UiComponent\ContextInterface;
+use Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier\ConfigurablePanel;
+use Magento\Framework\App\RequestInterface;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * AssociatedProductsTest
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class AssociatedProductsTest extends TestCase
{
/**
* @var \Magento\Framework\ObjectManagerInterface $objectManager
@@ -17,7 +29,10 @@ class AssociatedProductsTest extends \PHPUnit\Framework\TestCase
*/
private $registry;
- public function setUp()
+ /**
+ * @inheritdoc
+ */
+ public function setUp(): void
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
$this->registry = $this->objectManager->get(\Magento\Framework\Registry::class);
@@ -64,6 +79,53 @@ public function testGetProductMatrix($interfaceLocale)
}
}
+ /**
+ * Tests configurable product won't appear in product listing.
+ *
+ * Tests configurable product won't appear in configurable associated product listing if its options attribute
+ * is not filterable in grid.
+ *
+ * @return void
+ * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
+ * @magentoAppArea adminhtml
+ */
+ public function testAddManuallyConfigurationsWithNotFilterableInGridAttribute(): void
+ {
+ /** @var RequestInterface $request */
+ $request = $this->objectManager->get(RequestInterface::class);
+ $request->setParams([
+ FilterModifier::FILTER_MODIFIER => [
+ 'test_configurable' => [
+ 'condition_type' => 'notnull',
+ ],
+ ],
+ 'attributes_codes' => [
+ 'test_configurable'
+ ],
+ ]);
+ $context = $this->objectManager->create(ContextInterface::class, ['request' => $request]);
+ /** @var UiComponentFactory $uiComponentFactory */
+ $uiComponentFactory = $this->objectManager->get(UiComponentFactory::class);
+ $uiComponent = $uiComponentFactory->create(
+ ConfigurablePanel::ASSOCIATED_PRODUCT_LISTING,
+ null,
+ ['context' => $context]
+ );
+
+ foreach ($uiComponent->getChildComponents() as $childUiComponent) {
+ $childUiComponent->prepare();
+ }
+
+ $dataSource = $uiComponent->getDataSourceData();
+ $skus = array_column($dataSource['data']['items'], 'sku');
+
+ $this->assertNotContains(
+ 'configurable',
+ $skus,
+ 'Only products with specified attribute should be in product list'
+ );
+ }
+
/**
* @return array
*/
diff --git a/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight.php b/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight.php
new file mode 100644
index 0000000000000..40e01a81ac807
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight.php
@@ -0,0 +1,29 @@
+get(\Magento\Framework\App\ResourceConnection::class);
+$connection = $resource->getConnection();
+$resourceModel = $objectManager->create(\Magento\OfflineShipping\Model\ResourceModel\Carrier\Tablerate::class);
+$entityTable = $resourceModel->getTable('shipping_tablerate');
+$data =
+ [
+ 'website_id' => 1,
+ 'dest_country_id' => 'US',
+ 'dest_region_id' => 0,
+ 'dest_zip' => '*',
+ 'condition_name' => 'package_weight',
+ 'condition_value' => 0,
+ 'price' => 10,
+ 'cost' => 0
+ ];
+$connection->query(
+ "INSERT INTO {$entityTable} (`website_id`, `dest_country_id`, `dest_region_id`, `dest_zip`, `condition_name`,"
+ . "`condition_value`, `price`, `cost`) VALUES (:website_id, :dest_country_id, :dest_region_id, :dest_zip,"
+ . " :condition_name, :condition_value, :price, :cost);",
+ $data
+);
diff --git a/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight_rollback.php b/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight_rollback.php
new file mode 100644
index 0000000000000..cb6e9353b8972
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/OfflineShipping/_files/tablerates_weight_rollback.php
@@ -0,0 +1,8 @@
+api = $this->getMockBuilder(Nvp::class)
->disableOriginalConstructor()
- ->setMethods(['call', 'getExportedShippingAddress', 'getExportedBillingAddress'])
+ ->setMethods(['call', 'getExportedShippingAddress', 'getExportedBillingAddress', 'getShippingRateCode'])
->getMock();
$this->api->expects($this->any())
@@ -302,6 +302,8 @@ public function testReturnFromPaypal()
public function testReturnFromPaypalButton()
{
$quote = $this->getFixtureQuote();
+ $quote->getShippingAddress()->setShippingMethod('');
+
$this->prepareCheckoutModel($quote);
$quote->getPayment()->setAdditionalInformation(Checkout::PAYMENT_INFO_BUTTON, 1);
@@ -317,6 +319,8 @@ public function testReturnFromPaypalButton()
$this->assertEquals($exportedShippingData['telephone'], $shippingAddress->getTelephone());
$this->assertEquals($exportedShippingData['email'], $shippingAddress->getEmail());
+ $this->assertEquals('flatrate_flatrate', $shippingAddress->getShippingMethod());
+
$this->assertEquals([$exportedShippingData['street']], $billingAddress->getStreet());
$this->assertEquals($exportedShippingData['firstname'], $billingAddress->getFirstname());
$this->assertEquals($exportedShippingData['city'], $billingAddress->getCity());
@@ -551,6 +555,9 @@ private function prepareCheckoutModel(Quote $quote, $prefix = '')
$this->api->method('getExportedShippingAddress')
->willReturn($exportedShippingAddress);
+ $this->api->method('getShippingRateCode')
+ ->willReturn('flatrate_flatrate Flat Rate - Fixed');
+
$this->paypalInfo->method('importToPayment')
->with($this->api, $quote->getPayment());
}
@@ -573,7 +580,7 @@ private function getExportedData(): array
'city' => 'Denver',
'street' => '66 Pearl St',
'postcode' => '80203',
- 'telephone' => '555-555-555'
+ 'telephone' => '555-555-555',
],
'billing' => [
'email' => 'customer@example.com',
diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Guest/FormTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Guest/FormTest.php
new file mode 100644
index 0000000000000..1067a474e19aa
--- /dev/null
+++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Guest/FormTest.php
@@ -0,0 +1,109 @@
+prepareRequestData();
+ $this->dispatch('sales/guest/view/');
+ $content = $this->getResponse()->getBody();
+ $this->assertContains('Order # 100000001', $content);
+ }
+
+ /**
+ * View order as logged in customer
+ *
+ * @magentoDataFixture Magento/Sales/_files/order.php
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testViewOrderAsLoggedIn()
+ {
+ $this->login(1);
+ $this->dispatch('sales/guest/view/');
+ $this->assertRedirect($this->stringContains('sales/order/history/'));
+ }
+
+ /**
+ * Test attempting to open the Returns form as logged in customer
+ *
+ * @magentoDataFixture Magento/Sales/_files/order.php
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testAttemptToOpenTheFormAsLoggedIn()
+ {
+ $this->login(1);
+ $this->dispatch('sales/guest/form/');
+ $this->assertRedirect($this->stringContains('customer/account'));
+ }
+
+ /**
+ * Test Return Order for guest with incorrect data
+ */
+ public function testViewOrderAsGuestWithIncorrectData()
+ {
+ $this->prepareRequestData(true);
+ $this->dispatch('sales/guest/view/');
+ $this->assertSessionMessages(
+ $this->equalTo(['You entered incorrect data. Please try again.']),
+ MessageInterface::TYPE_ERROR
+ );
+ }
+
+ /**
+ * Login the user
+ *
+ * @param string $customerId Customer to mark as logged in for the session
+ * @return void
+ */
+ protected function login($customerId)
+ {
+ /** @var Session $session */
+ $session = $this->_objectManager->get(Session::class);
+ $session->loginById($customerId);
+ }
+
+ /**
+ * @param bool $invalidData
+ * @return void
+ */
+ private function prepareRequestData($invalidData = false)
+ {
+ $orderId = 100000001;
+ $email = $invalidData ? 'wrong@example.com' : 'customer@null.com';
+
+ /** @var FormKey $formKey */
+ $formKey = $this->_objectManager->get(FormKey::class);
+ $post = [
+ 'oar_order_id' => $orderId,
+ 'oar_billing_lastname' => 'lastname',
+ 'oar_type' => 'email',
+ 'oar_email' => $email,
+ 'oar_zip' => '',
+ 'form_key' => $formKey->getFormKey(),
+ ];
+
+ $this->getRequest()->setMethod(Request::METHOD_POST);
+ $this->getRequest()->setPostValue($post);
+ }
+}
diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
index 92eae7a3fe3d7..940d05eb4d5d7 100644
--- a/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Wishlist/Controller/IndexTest.php
@@ -128,6 +128,7 @@ public function testAddActionProductNameXss()
public function testAllcartAction()
{
$formKey = $this->_objectManager->get(\Magento\Framework\Data\Form\FormKey::class)->getFormKey();
+ $this->getRequest()->setMethod('POST');
$this->getRequest()->setParam('form_key', $formKey);
$this->dispatch('wishlist/index/allcart');
diff --git a/dev/tests/static/framework/Magento/ruleset.xml b/dev/tests/static/framework/Magento/ruleset.xml
index d0f0d38f8fa03..9dde4b7bd7d32 100644
--- a/dev/tests/static/framework/Magento/ruleset.xml
+++ b/dev/tests/static/framework/Magento/ruleset.xml
@@ -84,5 +84,6 @@
+
diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/RequestConfigTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/RequestConfigTest.php
index 4c0fed148aea8..f0177c449a3f9 100644
--- a/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/RequestConfigTest.php
+++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Framework/Search/RequestConfigTest.php
@@ -102,8 +102,7 @@ public function testFileSchemaUsingInvalidXml($expectedErrors = null)
Element 'metric', attribute 'type': [facet 'enumeration'] " .
"The value 'sumasdasd' is not an element of the set {'sum', 'count', 'min', 'max', 'avg'}.
Element 'metric', attribute 'type': 'sumasdasd' is not a valid value of the local atomic type.
-Element 'bucket': Missing child element(s). Expected is one of ( metrics, ranges ).
-Element 'request': Missing child element(s). Expected is ( from )."
+Element 'bucket': Missing child element(s). Expected is one of ( metrics, ranges )."
)
);
parent::testFileSchemaUsingInvalidXml($expectedErrors);
diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
index 0450ae1330cd8..c8f363dfbb716 100644
--- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
+++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt
@@ -209,3 +209,8 @@ Magento/Customer/Model/FileUploaderDataResolver.php
Magento/Customer/Model/Customer/DataProvider.php
Magento/InventoryShippingAdminUi/Ui/DataProvider
Magento/Elasticsearch6/Model/Client
+Magento/CatalogSearch/Model/ResourceModel/Advanced/Collection
+Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection
+Magento/Elasticsearch/Model/Layer/Category/ItemCollectionProvider
+Magento/Elasticsearch/Model/Layer/Search/ItemCollectionProvider
+Magento/Elasticsearch/Model/Adapter/FieldMapper/Product/FieldProvider/FieldName/Resolver/CompositeResolver
diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php
index 897b67d8d46ec..f4d83ece134cf 100644
--- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php
+++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/Adapter.php
@@ -86,6 +86,7 @@ public function query(RequestInterface $request)
$response = [
'documents' => $documents,
'aggregations' => $aggregations,
+ 'total' => count($documents)
];
return $this->responseFactory->create($response);
}
diff --git a/lib/internal/Magento/Framework/Search/Adapter/Mysql/ResponseFactory.php b/lib/internal/Magento/Framework/Search/Adapter/Mysql/ResponseFactory.php
index 776dab93c2dcd..b41a43883fde5 100644
--- a/lib/internal/Magento/Framework/Search/Adapter/Mysql/ResponseFactory.php
+++ b/lib/internal/Magento/Framework/Search/Adapter/Mysql/ResponseFactory.php
@@ -68,7 +68,8 @@ public function create($rawResponse)
\Magento\Framework\Search\Response\QueryResponse::class,
[
'documents' => $documents,
- 'aggregations' => $aggregations
+ 'aggregations' => $aggregations,
+ 'total' => $rawResponse['total']
]
);
}
diff --git a/lib/internal/Magento/Framework/Search/Request.php b/lib/internal/Magento/Framework/Search/Request.php
index d55b2085e87ef..60f3338046613 100644
--- a/lib/internal/Magento/Framework/Search/Request.php
+++ b/lib/internal/Magento/Framework/Search/Request.php
@@ -54,6 +54,11 @@ class Request implements RequestInterface
*/
protected $dimensions;
+ /**
+ * @var array
+ */
+ private $sort;
+
/**
* @param string $name
* @param string $indexName
@@ -62,6 +67,7 @@ class Request implements RequestInterface
* @param int|null $size
* @param Dimension[] $dimensions
* @param RequestBucketInterface[] $buckets
+ * @param array $sort
*/
public function __construct(
$name,
@@ -70,7 +76,8 @@ public function __construct(
$from = null,
$size = null,
array $dimensions = [],
- array $buckets = []
+ array $buckets = [],
+ $sort = []
) {
$this->name = $name;
$this->index = $indexName;
@@ -79,10 +86,11 @@ public function __construct(
$this->size = $size;
$this->buckets = $buckets;
$this->dimensions = $dimensions;
+ $this->sort = $sort;
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getName()
{
@@ -90,7 +98,7 @@ public function getName()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getIndex()
{
@@ -98,7 +106,7 @@ public function getIndex()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getDimensions()
{
@@ -106,7 +114,7 @@ public function getDimensions()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getAggregation()
{
@@ -114,7 +122,7 @@ public function getAggregation()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getQuery()
{
@@ -122,7 +130,7 @@ public function getQuery()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getFrom()
{
@@ -130,10 +138,18 @@ public function getFrom()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getSize()
{
return $this->size;
}
+
+ /**
+ * @inheritdoc
+ */
+ public function getSort()
+ {
+ return $this->sort;
+ }
}
diff --git a/lib/internal/Magento/Framework/Search/Request/Binder.php b/lib/internal/Magento/Framework/Search/Request/Binder.php
index 34b5d72005e74..9df1ee87eb869 100644
--- a/lib/internal/Magento/Framework/Search/Request/Binder.php
+++ b/lib/internal/Magento/Framework/Search/Request/Binder.php
@@ -6,6 +6,8 @@
namespace Magento\Framework\Search\Request;
/**
+ * Data binder for search request.
+ *
* @api
*/
class Binder
@@ -24,6 +26,9 @@ public function bind(array $requestData, array $bindData)
$data['queries'] = $this->processData($requestData['queries'], $bindData['placeholder']);
$data['filters'] = $this->processData($requestData['filters'], $bindData['placeholder']);
$data['aggregations'] = $this->processData($requestData['aggregations'], $bindData['placeholder']);
+ if (isset($bindData['sort']) && isset($requestData['sort'])) {
+ $data['sort'] = $this->processData($requestData['sort'], $bindData['sort']);
+ }
return $data;
}
@@ -48,6 +53,8 @@ private function processLimits($data, $bindData)
}
/**
+ * Dimensions process.
+ *
* @param array $data
* @param array $bindData
* @return array
diff --git a/lib/internal/Magento/Framework/Search/Request/Builder.php b/lib/internal/Magento/Framework/Search/Request/Builder.php
index a16b3369cdda0..74bc65010a934 100644
--- a/lib/internal/Magento/Framework/Search/Request/Builder.php
+++ b/lib/internal/Magento/Framework/Search/Request/Builder.php
@@ -11,7 +11,10 @@
use Magento\Framework\Search\RequestInterface;
/**
+ * Search request builder.
+ *
* @api
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Builder
{
@@ -95,6 +98,18 @@ public function setFrom($from)
return $this;
}
+ /**
+ * Set sort.
+ *
+ * @param \Magento\Framework\Api\SortOrder[] $sort
+ * @return $this
+ */
+ public function setSort($sort)
+ {
+ $this->data['sort'] = $sort;
+ return $this;
+ }
+
/**
* Bind dimension data by name
*
@@ -139,6 +154,9 @@ public function create()
}
$data = $this->binder->bind($data, $this->data);
+ if (isset($this->data['sort'])) {
+ $data['sort'] = $this->prepareSorts($this->data['sort']);
+ }
$data = $this->cleaner->clean($data);
$this->clear();
@@ -146,6 +164,25 @@ public function create()
return $this->convert($data);
}
+ /**
+ * Prepare sort data for request.
+ *
+ * @param array $sorts
+ * @return array
+ */
+ private function prepareSorts(array $sorts)
+ {
+ $sortData = [];
+ foreach ($sorts as $sortField => $direction) {
+ $sortData[] = [
+ 'field' => $sortField,
+ 'direction' => $direction,
+ ];
+ }
+
+ return $sortData;
+ }
+
/**
* Clear data
*
@@ -178,21 +215,27 @@ private function convert($data)
'filters' => $data['filters']
]
);
+ $requestData = [
+ 'name' => $data['query'],
+ 'indexName' => $data['index'],
+ 'from' => $data['from'],
+ 'size' => $data['size'],
+ 'query' => $mapper->getRootQuery(),
+ 'dimensions' => $this->buildDimensions(isset($data['dimensions']) ? $data['dimensions'] : []),
+ 'buckets' => $mapper->getBuckets()
+ ];
+ if (isset($data['sort'])) {
+ $requestData['sort'] = $data['sort'];
+ }
return $this->objectManager->create(
\Magento\Framework\Search\Request::class,
- [
- 'name' => $data['query'],
- 'indexName' => $data['index'],
- 'from' => $data['from'],
- 'size' => $data['size'],
- 'query' => $mapper->getRootQuery(),
- 'dimensions' => $this->buildDimensions(isset($data['dimensions']) ? $data['dimensions'] : []),
- 'buckets' => $mapper->getBuckets()
- ]
+ $requestData
);
}
/**
+ * Build dimensions.
+ *
* @param array $dimensionsData
* @return array
*/
diff --git a/lib/internal/Magento/Framework/Search/RequestInterface.php b/lib/internal/Magento/Framework/Search/RequestInterface.php
index 16df80f755c07..2de756e754a27 100644
--- a/lib/internal/Magento/Framework/Search/RequestInterface.php
+++ b/lib/internal/Magento/Framework/Search/RequestInterface.php
@@ -64,4 +64,11 @@ public function getFrom();
* @return int|null
*/
public function getSize();
+
+ /**
+ * Get Sort items
+ *
+ * @return array
+ */
+ public function getSort();
}
diff --git a/lib/internal/Magento/Framework/Search/Response/QueryResponse.php b/lib/internal/Magento/Framework/Search/Response/QueryResponse.php
index c2328398e53dc..90c7056ea2549 100644
--- a/lib/internal/Magento/Framework/Search/Response/QueryResponse.php
+++ b/lib/internal/Magento/Framework/Search/Response/QueryResponse.php
@@ -29,18 +29,26 @@ class QueryResponse implements ResponseInterface
*/
protected $aggregations;
+ /**
+ * @var int
+ */
+ private $total;
+
/**
* @param Document[] $documents
* @param AggregationInterface $aggregations
+ * @param int $total
*/
- public function __construct(array $documents, AggregationInterface $aggregations)
+ public function __construct(array $documents, AggregationInterface $aggregations, int $total = 0)
{
$this->documents = $documents;
$this->aggregations = $aggregations;
+ $this->total = $total;
}
/**
- * Countable: return count of fields in document
+ * Countable: return count of fields in document.
+ *
* @return int
*/
public function count()
@@ -59,10 +67,18 @@ public function getIterator()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getAggregations()
{
return $this->aggregations;
}
+
+ /**
+ * @inheritdoc
+ */
+ public function getTotal(): int
+ {
+ return $this->total;
+ }
}
diff --git a/lib/internal/Magento/Framework/Search/ResponseInterface.php b/lib/internal/Magento/Framework/Search/ResponseInterface.php
index 3b89528532602..c6c0d0ab59e10 100644
--- a/lib/internal/Magento/Framework/Search/ResponseInterface.php
+++ b/lib/internal/Magento/Framework/Search/ResponseInterface.php
@@ -16,4 +16,11 @@ interface ResponseInterface extends \IteratorAggregate, \Countable
* @return \Magento\Framework\Api\Search\AggregationInterface
*/
public function getAggregations();
+
+ /**
+ * Return total count of items.
+ *
+ * @return int
+ */
+ public function getTotal(): int;
}
diff --git a/lib/internal/Magento/Framework/Search/Search.php b/lib/internal/Magento/Framework/Search/Search.php
index 16dfc6fdd1ddb..fe228546b55fb 100644
--- a/lib/internal/Magento/Framework/Search/Search.php
+++ b/lib/internal/Magento/Framework/Search/Search.php
@@ -10,6 +10,9 @@
use Magento\Framework\App\ScopeResolverInterface;
use Magento\Framework\Search\Request\Builder;
+/**
+ * Search API for all requests.
+ */
class Search implements SearchInterface
{
/**
@@ -51,7 +54,7 @@ public function __construct(
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function search(SearchCriteriaInterface $searchCriteria)
{
@@ -68,6 +71,7 @@ public function search(SearchCriteriaInterface $searchCriteria)
$this->requestBuilder->setFrom($searchCriteria->getCurrentPage() * $searchCriteria->getPageSize());
$this->requestBuilder->setSize($searchCriteria->getPageSize());
+ $this->requestBuilder->setSort($searchCriteria->getSortOrders());
$request = $this->requestBuilder->create();
$searchResponse = $this->searchEngine->search($request);
diff --git a/lib/internal/Magento/Framework/Search/SearchResponseBuilder.php b/lib/internal/Magento/Framework/Search/SearchResponseBuilder.php
index 40fcd493861d7..2314252f4609c 100644
--- a/lib/internal/Magento/Framework/Search/SearchResponseBuilder.php
+++ b/lib/internal/Magento/Framework/Search/SearchResponseBuilder.php
@@ -9,6 +9,9 @@
use Magento\Framework\Api\Search\DocumentFactory;
use Magento\Framework\Api\Search\SearchResultFactory;
+/**
+ * Builder for search response.
+ */
class SearchResponseBuilder
{
/**
@@ -35,6 +38,8 @@ public function __construct(
}
/**
+ * Build search result by search response.
+ *
* @param ResponseInterface $response
* @return SearchResultInterface
*/
@@ -46,7 +51,7 @@ public function build(ResponseInterface $response)
$documents = iterator_to_array($response);
$searchResult->setItems($documents);
$searchResult->setAggregations($response->getAggregations());
- $searchResult->setTotalCount(count($documents));
+ $searchResult->setTotalCount($response->getTotal());
return $searchResult;
}
diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/AdapterTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/AdapterTest.php
index 55d26493ca379..a35e1fd8b6151 100644
--- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/AdapterTest.php
+++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/AdapterTest.php
@@ -155,6 +155,7 @@ public function testQuery()
'aggregation2' => [2, 4],
],
],
+ 'total' => 1
];
$select = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/ResponseFactoryTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/ResponseFactoryTest.php
index c0699156decd0..3d21064b13d47 100644
--- a/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/ResponseFactoryTest.php
+++ b/lib/internal/Magento/Framework/Search/Test/Unit/Adapter/Mysql/ResponseFactoryTest.php
@@ -49,6 +49,7 @@ public function testCreate()
['title' => 'twoTitle', 'description' => 'twoDescription'],
],
'aggregations' => [],
+ 'total' => 2
];
$this->documentFactory->expects($this->at(0))->method('create')
@@ -61,7 +62,7 @@ public function testCreate()
$this->objectManager->expects($this->once())->method('create')
->with(
$this->equalTo(\Magento\Framework\Search\Response\QueryResponse::class),
- $this->equalTo(['documents' => ['document1', 'document2'], 'aggregations' => null])
+ $this->equalTo(['documents' => ['document1', 'document2'], 'aggregations' => null, 'total' => 2])
)
->will($this->returnValue('QueryResponseObject'));
diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/Response/QueryResponseTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/Response/QueryResponseTest.php
index a60a280cb602a..a994559f28f0b 100644
--- a/lib/internal/Magento/Framework/Search/Test/Unit/Response/QueryResponseTest.php
+++ b/lib/internal/Magento/Framework/Search/Test/Unit/Response/QueryResponseTest.php
@@ -46,6 +46,7 @@ protected function setUp()
[
'documents' => $this->documents,
'aggregations' => $this->aggregations,
+ 'total' => 1
]
);
}
diff --git a/lib/internal/Magento/Framework/Search/Test/Unit/SearchResponseBuilderTest.php b/lib/internal/Magento/Framework/Search/Test/Unit/SearchResponseBuilderTest.php
index a0b11959a42db..9ffafae9622f3 100644
--- a/lib/internal/Magento/Framework/Search/Test/Unit/SearchResponseBuilderTest.php
+++ b/lib/internal/Magento/Framework/Search/Test/Unit/SearchResponseBuilderTest.php
@@ -67,7 +67,7 @@ public function testBuild()
/** @var QueryResponse|\PHPUnit_Framework_MockObject_MockObject $response */
$response = $this->getMockBuilder(\Magento\Framework\Search\Response\QueryResponse::class)
- ->setMethods(['getIterator', 'getAggregations'])
+ ->setMethods(['getIterator', 'getAggregations', 'getTotal'])
->disableOriginalConstructor()
->getMockForAbstractClass();
$response->expects($this->any())
@@ -76,6 +76,9 @@ public function testBuild()
$response->expects($this->once())
->method('getAggregations')
->willReturn($aggregations);
+ $response->expects($this->any())
+ ->method('getTotal')
+ ->willReturn(1);
$result = $this->model->build($response);
diff --git a/lib/internal/Magento/Framework/Search/etc/requests.xsd b/lib/internal/Magento/Framework/Search/etc/requests.xsd
index a49124748b295..7d277382b698f 100644
--- a/lib/internal/Magento/Framework/Search/etc/requests.xsd
+++ b/lib/internal/Magento/Framework/Search/etc/requests.xsd
@@ -28,8 +28,8 @@
-
-
+
+
diff --git a/lib/web/mage/tabs.js b/lib/web/mage/tabs.js
index b441477ab8d8a..65c452d33bf12 100644
--- a/lib/web/mage/tabs.js
+++ b/lib/web/mage/tabs.js
@@ -72,7 +72,7 @@ define([
if (anchor && isValid) {
$.each(self.contents, function (i) {
- if ($(this).attr('id') === anchorId) {
+ if ($(this).attr('id') === anchorId || $(this).find('#' + anchorId).length) {
self.collapsibles.not(self.collapsibles.eq(i)).collapsible('forceDeactivate');
return false;