Skip to content

Commit 49811b5

Browse files
committed
Merge remote-tracking branch 'origin/MC-29658' into 2.4-develop-pr1
2 parents 6213ff9 + 4903c50 commit 49811b5

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

setup/src/Magento/Setup/Fixtures/CategoriesFixture.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Catalog\Model\Category;
1010
use Magento\Catalog\Model\CategoryFactory;
1111
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
12+
use Magento\Store\Model\Store;
1213
use Magento\Store\Model\StoreManager;
1314

1415
/**
@@ -82,7 +83,7 @@ public function __construct(
8283
protected $priority = 20;
8384

8485
/**
85-
* {@inheritdoc}
86+
* @inheritdoc
8687
*/
8788
public function execute()
8889
{
@@ -97,7 +98,7 @@ public function execute()
9798
$category = $this->categoryFactory->create();
9899
$category->load($parentCategoryId);
99100
// Need for generation url rewrites per all category store view
100-
$category->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
101+
$category->setStoreId(Store::DEFAULT_STORE_ID);
101102
$categoryIndex = 1;
102103
$this->generateCategories(
103104
$category,
@@ -130,6 +131,7 @@ private function generateCategories(
130131
$category->setId(null)
131132
->setUrlKey(null)
132133
->setUrlPath(null)
134+
->setStoreId(Store::DEFAULT_STORE_ID)
133135
->setName($this->getCategoryName($parentCategory, $nestingLevel, $i))
134136
->setParentId($parentCategory->getId())
135137
->setLevel($parentCategory->getLevel() + 1)
@@ -237,15 +239,15 @@ private function getCategoryPrefix()
237239
}
238240

239241
/**
240-
* {@inheritdoc}
242+
* @inheritdoc
241243
*/
242244
public function getActionTitle()
243245
{
244246
return 'Generating categories';
245247
}
246248

247249
/**
248-
* {@inheritdoc}
250+
* @inheritdoc
249251
*/
250252
public function introduceParamLabels()
251253
{

setup/src/Magento/Setup/Test/Unit/Fixtures/CategoriesFixtureTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1313
use Magento\Setup\Fixtures\CategoriesFixture;
1414
use Magento\Setup\Fixtures\FixtureModel;
15+
use Magento\Store\Model\Store;
1516

1617
class CategoriesFixtureTest extends \PHPUnit\Framework\TestCase
1718
{
@@ -40,7 +41,10 @@ class CategoriesFixtureTest extends \PHPUnit\Framework\TestCase
4041
*/
4142
private $categoryFactoryMock;
4243

43-
public function setUp()
44+
/**
45+
* @inhertidoc
46+
*/
47+
protected function setUp()
4448
{
4549
$this->fixtureModelMock = $this->createMock(FixtureModel::class);
4650
$this->collectionFactoryMock = $this->createPartialMock(CollectionFactory::class, ['create']);
@@ -146,6 +150,10 @@ public function testExecute()
146150
$categoryMock->expects($this->once())
147151
->method('setIsActive')
148152
->willReturnSelf();
153+
$categoryMock->expects($this->exactly(2))
154+
->method('setStoreId')
155+
->with(Store::DEFAULT_STORE_ID)
156+
->willReturnSelf();
149157

150158
$this->categoryFactoryMock->expects($this->once())->method('create')->willReturn($categoryMock);
151159

0 commit comments

Comments
 (0)