-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #13844: Fix issue 13827 (by @julienanquetil) - #13817: Allow changing head and body element through xml layout updates (by @cedricziel) - #13567: Add integration tests for product urls rewrite generation (by @adrien-louis-r) - #13038: Default Welcome message is broken on storefront with enabled translate-inline (by @pareshpansuriya) - #13828: Inconsistent Redirect in Admin Notification Controller (by @chickenland) - #13787: Issue-13768 Fixed error messages on admin user account page after redirect for force password change (by @nuzil) Fixed GitHub Issues: - #13350: Magento 2.2 Encoding Issue -> Google Analytics (reported by @danielpfarmer) has been fixed in #13844 by @julienanquetil in 2.2-develop branch Related commits: 1. 5843e81 2. 0d5197f - #13827: Google Analytics character encoding issue ( \u0020 ) (reported by @Munszu) has been fixed in #13844 by @julienanquetil in 2.2-develop branch Related commits: 1. 5843e81 2. 0d5197f - #4454: CMS Page with <head> in layout update xml (reported by @zhiyicai) has been fixed in #13817 by @cedricziel in 2.2-develop branch Related commits: 1. 341cdaf - #5863: URL Rewrite issues occur very often /catalog/product/view/id/711/s/product-name/category/16/ (reported by @kayintveen) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch Related commits: 1. 1ef4dcc 2. 864f371 - #8227: After upgrade to 2.1.3 url rewrite problem multi store (reported by @philipvandebriel) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch Related commits: 1. 1ef4dcc 2. 864f371 - #8957: Permanent Redirect for old URL missing via API (reported by @MarcoGrecoBitbull) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch Related commits: 1. 1ef4dcc 2. 864f371 - #10073: Magento don't create product redirect if URL key on store view level was changed. (reported by @sergei-sss) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch Related commits: 1. 1ef4dcc 2. 864f371 - #13240: Permanent 301 redirect is not generated when product url changes on storeview scope (reported by @koenner01) has been fixed in #13567 by @adrien-louis-r in 2.2-develop branch Related commits: 1. 1ef4dcc 2. 864f371 - #12711: Default Welcome message is broken on storefront with enabled translate-inline (reported by @alena-marchenko) has been fixed in #13038 by @pareshpansuriya in 2.2-develop branch Related commits: 1. 6144c4f 2. 7e913f1 3. cbc704d - #13768: Expired backend password - Attention: Something went wrong (reported by @janssensjelle) has been fixed in #13787 by @nuzil in 2.2-develop branch Related commits: 1. 96a8b58
- Loading branch information
Showing
8 changed files
with
294 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230 changes: 230 additions & 0 deletions
230
...stsuite/Magento/CatalogUrlRewrite/Observer/ProductProcessUrlRewriteSavingObserverTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\CatalogUrlRewrite\Observer; | ||
|
||
use Magento\Store\Model\StoreManagerInterface; | ||
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; | ||
use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; | ||
|
||
/** | ||
* @magentoAppArea adminhtml | ||
*/ | ||
class ProductProcessUrlRewriteSavingObserverTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** @var \Magento\Framework\ObjectManagerInterface */ | ||
protected $objectManager; | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); | ||
} | ||
|
||
/** | ||
* @param array $filter | ||
* @return array | ||
*/ | ||
private function getActualResults(array $filter) | ||
{ | ||
/** @var \Magento\UrlRewrite\Model\UrlFinderInterface $urlFinder */ | ||
$urlFinder = $this->objectManager->get(\Magento\UrlRewrite\Model\UrlFinderInterface::class); | ||
$actualResults = []; | ||
foreach ($urlFinder->findAllByData($filter) as $url) { | ||
$actualResults[] = [ | ||
'request_path' => $url->getRequestPath(), | ||
'target_path' => $url->getTargetPath(), | ||
'is_auto_generated' => (int)$url->getIsAutogenerated(), | ||
'redirect_type' => $url->getRedirectType(), | ||
'store_id' => $url->getStoreId() | ||
]; | ||
} | ||
return $actualResults; | ||
} | ||
|
||
/** | ||
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testUrlKeyHasChangedInGlobalContext() | ||
{ | ||
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/ | ||
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); | ||
/** @var \Magento\Catalog\Model\Product $product*/ | ||
$product = $productRepository->get('product1'); | ||
|
||
/** @var StoreManagerInterface $storeManager */ | ||
$storeManager = $this->objectManager->get(StoreManagerInterface::class); | ||
$storeManager->setCurrentStore(0); | ||
|
||
$testStore = $storeManager->getStore('test'); | ||
$productFilter = [ | ||
UrlRewrite::ENTITY_TYPE => 'product', | ||
]; | ||
|
||
$expected = [ | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => 1, | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => $testStore->getId(), | ||
], | ||
]; | ||
$actual = $this->getActualResults($productFilter); | ||
foreach ($expected as $row) { | ||
$this->assertContains($row, $actual); | ||
} | ||
|
||
$product->setData('save_rewrites_history', true); | ||
$product->setUrlKey('new-url'); | ||
$product->save(); | ||
|
||
$expected = [ | ||
[ | ||
'request_path' => "new-url.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => 1, | ||
], | ||
[ | ||
'request_path' => "new-url.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => $testStore->getId(), | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "new-url.html", | ||
'is_auto_generated' => 0, | ||
'redirect_type' => 301, | ||
'store_id' => 1, | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "new-url.html", | ||
'is_auto_generated' => 0, | ||
'redirect_type' => 301, | ||
'store_id' => $testStore->getId(), | ||
], | ||
]; | ||
|
||
$actual = $this->getActualResults($productFilter); | ||
foreach ($expected as $row) { | ||
$this->assertContains($row, $actual); | ||
} | ||
} | ||
|
||
/** | ||
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testUrlKeyHasChangedInStoreviewContextWithPermanentRedirection() | ||
{ | ||
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/ | ||
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); | ||
/** @var \Magento\Catalog\Model\Product $product*/ | ||
$product = $productRepository->get('product1'); | ||
|
||
/** @var StoreManagerInterface $storeManager */ | ||
$storeManager = $this->objectManager->get(StoreManagerInterface::class); | ||
$storeManager->setCurrentStore(1); | ||
|
||
$testStore = $storeManager->getStore('test'); | ||
|
||
$productFilter = [ | ||
UrlRewrite::ENTITY_TYPE => 'product', | ||
]; | ||
|
||
$product->setData('save_rewrites_history', true); | ||
$product->setUrlKey('new-url'); | ||
$product->save(); | ||
|
||
$expected = [ | ||
[ | ||
'request_path' => "new-url.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => 1, | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => $testStore->getId(), | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "new-url.html", | ||
'is_auto_generated' => 0, | ||
'redirect_type' => 301, | ||
'store_id' => 1, | ||
], | ||
]; | ||
|
||
$actual = $this->getActualResults($productFilter); | ||
foreach ($expected as $row) { | ||
$this->assertContains($row, $actual); | ||
} | ||
} | ||
|
||
/** | ||
* @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php | ||
* @magentoAppIsolation enabled | ||
*/ | ||
public function testUrlKeyHasChangedInStoreviewContextWithoutPermanentRedirection() | ||
{ | ||
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository*/ | ||
$productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class); | ||
/** @var \Magento\Catalog\Model\Product $product*/ | ||
$product = $productRepository->get('product1'); | ||
|
||
/** @var StoreManagerInterface $storeManager */ | ||
$storeManager = $this->objectManager->get(StoreManagerInterface::class); | ||
$storeManager->setCurrentStore(1); | ||
|
||
$testStore = $storeManager->getStore('test'); | ||
|
||
$productFilter = [ | ||
UrlRewrite::ENTITY_TYPE => 'product', | ||
]; | ||
|
||
$product->setData('save_rewrites_history', false); | ||
$product->setUrlKey('new-url'); | ||
$product->save(); | ||
|
||
$expected = [ | ||
[ | ||
'request_path' => "new-url.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => 1, | ||
], | ||
[ | ||
'request_path' => "product-1.html", | ||
'target_path' => "catalog/product/view/id/" . $product->getId(), | ||
'is_auto_generated' => 1, | ||
'redirect_type' => 0, | ||
'store_id' => $testStore->getId(), | ||
], | ||
]; | ||
|
||
$actual = $this->getActualResults($productFilter); | ||
foreach ($expected as $row) { | ||
$this->assertContains($row, $actual); | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...sts/integration/testsuite/Magento/CatalogUrlRewrite/_files/product_rewrite_multistore.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
use Magento\Catalog\Api\ProductRepositoryInterface; | ||
use Magento\Catalog\Setup\CategorySetup; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
\Magento\TestFramework\Helper\Bootstrap::getInstance() | ||
->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); | ||
|
||
require __DIR__ . '/../../Store/_files/store.php'; | ||
|
||
/** @var $installer CategorySetup */ | ||
$objectManager = Bootstrap::getObjectManager(); | ||
$installer = $objectManager->create(CategorySetup::class); | ||
$storeManager = $objectManager->get(StoreManagerInterface::class); | ||
$storeManager->setCurrentStore(0); | ||
|
||
/** @var $product \Magento\Catalog\Model\Product */ | ||
$product = $objectManager->create(\Magento\Catalog\Model\Product::class); | ||
$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) | ||
->setAttributeSetId($installer->getAttributeSetId('catalog_product', 'Default')) | ||
->setStoreId(0) | ||
->setWebsiteIds([1]) | ||
->setName('Product1') | ||
->setSku('product1') | ||
->setPrice(10) | ||
->setWeight(18) | ||
->setStockData(['use_config_manage_stock' => 0]) | ||
->setUrlKey('product-1') | ||
->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) | ||
->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); | ||
|
||
/** @var ProductRepositoryInterface $productRepository */ | ||
$productRepository = $objectManager->get(ProductRepositoryInterface::class); | ||
$productRepository->save($product); |
12 changes: 12 additions & 0 deletions
12
...ration/testsuite/Magento/CatalogUrlRewrite/_files/product_rewrite_multistore_rollback.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
use Magento\Catalog\Api\ProductRepositoryInterface; | ||
use Magento\TestFramework\Helper\Bootstrap; | ||
|
||
$objectManager = Bootstrap::getObjectManager(); | ||
|
||
require __DIR__ . '/../../Store/_files/store_rollback.php'; | ||
require __DIR__ . '/../../Store/_files/second_store_rollback.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters