-
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: - #13716: Category\Collection::joinUrlRewrite should use the store set on the collection (by @alepane21) - #14317: FR#7428 - Multiline fields in forms have no visible label (by @crisdiaz) - #14358: Format code (by @mageprince) - #14230: Fix for broken navigation menu on IE11 (by @cstergianos) - #14303: Resolves PHPdoc issue in ticket #13992 (by @cream-julian) - #14306: [#14089] Add Malaysian Locale Code (by @osrecio) Fixed GitHub Issues: - #13704: Category\Collection::joinUrlRewrite should use the store set on the collection (reported by @alepane21) has been fixed in #13716 by @alepane21 in 2.2-develop branch Related commits: 1. fc73ae2 2. 8ec6e05 3. 0241a1c 4. 3320fec 5. c3ea127 6. eb04ab0 - #7428: Multiline fields in forms have no visible label (reported by @navarr) has been fixed in #14317 by @crisdiaz in 2.2-develop branch Related commits: 1. d1ea17d - #13992: Incorrect phpdoc should be Shipment\Item not Invoice\Item (reported by @ThisIsRuddy) has been fixed in #14303 by @cream-julian in 2.2-develop branch Related commits: 1. 564ab99 - #14089: Malaysian (Malaysia) missing from locale list (reported by @superdav42) has been fixed in #14306 by @osrecio in 2.2-develop branch Related commits: 1. 1cd6d1b
- Loading branch information
Showing
9 changed files
with
175 additions
and
4 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
39 changes: 39 additions & 0 deletions
39
...code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/Collection/UrlRewriteTest.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. | ||
*/ | ||
|
||
namespace Magento\Catalog\Test\Unit\Model\ResourceModel\Category\Collection; | ||
|
||
class UrlRewriteTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->model = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Category\Collection::class) | ||
->disableOriginalConstructor() | ||
->setMethodsExcept(['joinUrlRewrite', 'setStoreId', 'getStoreId']) | ||
->getMock(); | ||
} | ||
|
||
public function testStoreIdUsedByUrlRewrite() | ||
{ | ||
$cond = '{{table}}.is_autogenerated = 1 AND {{table}}.store_id = 100 AND {{table}}.entity_type = \'category\''; | ||
$this->model->expects($this->once()) | ||
->method('joinTable') | ||
->with( | ||
$this->anything(), | ||
$this->anything(), | ||
$this->anything(), | ||
$this->equalTo($cond), | ||
$this->anything() | ||
); | ||
$this->model->setStoreId(100); | ||
$this->model->joinUrlRewrite(); | ||
} | ||
} |
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
64 changes: 64 additions & 0 deletions
64
...sts/integration/testsuite/Magento/Catalog/Model/ResourceModel/Category/CollectionTest.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,64 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Catalog\Model\ResourceModel\Category; | ||
|
||
class CollectionTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \Magento\Catalog\Model\ResourceModel\Category\Collection | ||
*/ | ||
private $collection; | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection. | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Catalog\Model\ResourceModel\Category\Collection::class | ||
); | ||
} | ||
|
||
protected function setDown() | ||
{ | ||
/* Refresh stores memory cache after store deletion */ | ||
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( | ||
\Magento\Store\Model\StoreManagerInterface::class | ||
)->reinitStores(); | ||
} | ||
|
||
/** | ||
* @magentoAppIsolation enabled | ||
* @magentoDbIsolation enabled | ||
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php | ||
*/ | ||
public function testJoinUrlRewriteOnDefault() | ||
{ | ||
$categories = $this->collection->joinUrlRewrite()->addPathFilter('1/2/3'); | ||
$this->assertCount(1, $categories); | ||
/** @var $category \Magento\Catalog\Model\Category */ | ||
$category = $categories->getFirstItem(); | ||
$this->assertStringEndsWith('category.html', $category->getUrl()); | ||
} | ||
|
||
/** | ||
* @magentoAppIsolation enabled | ||
* @magentoDbIsolation enabled | ||
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.php | ||
*/ | ||
public function testJoinUrlRewriteNotOnDefaultStore() | ||
{ | ||
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() | ||
->create(\Magento\Store\Model\Store::class); | ||
$storeId = $store->load('second_category_store', 'code')->getId(); | ||
$categories = $this->collection->setStoreId($storeId)->joinUrlRewrite()->addPathFilter('1/2/3'); | ||
$this->assertCount(1, $categories); | ||
/** @var $category \Magento\Catalog\Model\Category */ | ||
$category = $categories->getFirstItem(); | ||
$this->assertStringEndsWith('category-3-on-2.html', $category->getUrl()); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...gration/testsuite/Magento/Catalog/Model/ResourceModel/_files/category_multiple_stores.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,66 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
/** @var \Magento\Catalog\Model\CategoryFactory $factory */ | ||
$factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Catalog\Model\CategoryFactory::class | ||
); | ||
/** @var \Magento\Catalog\Model\CategoryRepository $repository */ | ||
$repository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Catalog\Model\CategoryRepository::class | ||
); | ||
/** @var \Magento\Store\Model\StoreManagerInterface $storeManager */ | ||
$storeManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( | ||
\Magento\Store\Model\StoreManagerInterface::class | ||
); | ||
/** @var \Magento\Store\Model\Store $store */ | ||
$store = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Store\Model\Store::class); | ||
if (!$store->load('second_category_store', 'code')->getId()) { | ||
$websiteId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( | ||
\Magento\Store\Model\StoreManagerInterface::class | ||
)->getWebsite()->getId(); | ||
$groupId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( | ||
\Magento\Store\Model\StoreManagerInterface::class | ||
)->getWebsite()->getDefaultGroupId(); | ||
|
||
$store->setCode( | ||
'second_category_store' | ||
)->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::class | ||
)->reinitStores(); | ||
|
||
/** @var \Magento\Catalog\Model\Category $newCategory */ | ||
$newCategory = $factory->create(); | ||
$newCategory | ||
->setName('Category') | ||
->setParentId(2) | ||
->setLevel(2) | ||
->setPath('1/2/3') | ||
->setAvailableSortBy('name') | ||
->setDefaultSortBy('name') | ||
->setIsActive(true) | ||
->setPosition(1); | ||
$repository->save($newCategory); | ||
$currentStoreId = $storeManager->getStore()->getId(); | ||
$storeManager->setCurrentStore($storeManager->getStore($store->getId())); | ||
$newCategory->setUrlKey('category-3-on-2'); | ||
$repository->save($newCategory); | ||
$storeManager->setCurrentStore($storeManager->getStore($currentStoreId)); |
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