Skip to content

Commit c3056ae

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2-sample-data into MQE-1069
2 parents 621fd75 + cacfdb8 commit c3056ae

File tree

3 files changed

+48
-14
lines changed

3 files changed

+48
-14
lines changed

app/code/Magento/DownloadableSampleData/Model/Product/Converter.php

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,35 @@ class Converter extends \Magento\CatalogSampleData\Model\Product\Converter
2424
*/
2525
private $filesystem;
2626

27+
public function __construct(
28+
\Magento\Catalog\Model\Category\TreeFactory $categoryTreeFactory,
29+
\Magento\Catalog\Model\ResourceModel\Category\TreeFactory $categoryResourceTreeFactory,
30+
\Magento\Eav\Model\Config $eavConfig,
31+
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryCollectionFactory,
32+
\Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeCollectionFactory,
33+
\Magento\Eav\Model\ResourceModel\Entity\Attribute\Option\CollectionFactory $attrOptionCollectionFactory,
34+
\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $productCollectionFactory,
35+
\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory $fileContentFactory = null,
36+
Filesystem $filesystem = null
37+
) {
38+
parent::__construct(
39+
$categoryTreeFactory,
40+
$categoryResourceTreeFactory,
41+
$eavConfig,
42+
$categoryCollectionFactory,
43+
$attributeCollectionFactory,
44+
$attrOptionCollectionFactory,
45+
$productCollectionFactory
46+
);
47+
$this->fileContentFactory = $fileContentFactory ?: ObjectManager::getInstance()->get(
48+
\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class
49+
);
50+
$this->filesystem = $filesystem ?: ObjectManager::getInstance()->get(
51+
Filesystem::class
52+
);
53+
}
54+
55+
2756
/**
2857
* Get downloadable data from array
2958
*
@@ -159,11 +188,6 @@ public function getSamplesInfo()
159188
*/
160189
private function getFileContent()
161190
{
162-
if (!$this->fileContentFactory) {
163-
$this->fileContentFactory = ObjectManager::getInstance()->create(
164-
\Magento\Downloadable\Api\Data\File\ContentInterfaceFactory::class
165-
);
166-
}
167191
return $this->fileContentFactory->create();
168192
}
169193

@@ -173,11 +197,6 @@ private function getFileContent()
173197
*/
174198
private function getFilesystem()
175199
{
176-
if (!$this->filesystem) {
177-
$this->filesystem = ObjectManager::getInstance()->create(
178-
Filesystem::class
179-
);
180-
}
181200
return $this->filesystem;
182201
}
183202
}

app/code/Magento/OfflineShippingSampleData/Model/Tablerate.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Config\App\Config\Type\System as SystemConfig;
11+
use Magento\OfflineShipping\Model\Carrier\Tablerate as CarrierTablerate;
1112

1213
/**
1314
* Class Tablerate
@@ -128,7 +129,7 @@ public function install(array $fixtures)
128129
'dest_country_id' => $data['country'],
129130
'dest_region_id' => $regionId,
130131
'dest_zip' => $data['zip'],
131-
'condition_name' => 'package_value',
132+
'condition_name' => 'package_value_with_discount',
132133
'condition_value' => $data['order_subtotal'],
133134
'price' => $data['price'],
134135
'cost' => 0,
@@ -146,7 +147,9 @@ public function install(array $fixtures)
146147
}
147148

148149
$this->configWriter->save('carriers/tablerate/active', 1);
149-
$this->configWriter->save('carriers/tablerate/condition_name', 'package_value');
150+
$this->configWriter->save(
151+
'carriers/tablerate/condition_name', 'package_value_with_discount'
152+
);
150153
$this->cacheTypeList->cleanType('config');
151154
$this->systemConfig->clean();
152155
}

app/code/Magento/WidgetSampleData/Model/CmsBlock.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Framework\Serialize\Serializer\Json;
99
use Magento\Framework\Setup\SampleData\Context as SampleDataContext;
10+
use \Magento\Framework\App\State;
1011

1112
/**
1213
* Launches setup of sample data for Widget module
@@ -53,6 +54,11 @@ class CmsBlock
5354
*/
5455
private $serializer;
5556

57+
/**
58+
* @var State
59+
*/
60+
private $appState;
61+
5662
/**
5763
* @param SampleDataContext $sampleDataContext
5864
* @param \Magento\Widget\Model\Widget\InstanceFactory $widgetFactory
@@ -61,6 +67,7 @@ class CmsBlock
6167
* @param \Magento\Widget\Model\ResourceModel\Widget\Instance\CollectionFactory $appCollectionFactory
6268
* @param \Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryFactory
6369
* @param Json|null $serializer
70+
* @param State|null $appState
6471
*/
6572
public function __construct(
6673
SampleDataContext $sampleDataContext,
@@ -69,7 +76,8 @@ public function __construct(
6976
\Magento\Cms\Model\BlockFactory $cmsBlockFactory,
7077
\Magento\Widget\Model\ResourceModel\Widget\Instance\CollectionFactory $appCollectionFactory,
7178
\Magento\Catalog\Model\ResourceModel\Category\CollectionFactory $categoryFactory,
72-
Json $serializer = null
79+
Json $serializer = null,
80+
State $appState = null
7381
) {
7482
$this->fixtureManager = $sampleDataContext->getFixtureManager();
7583
$this->csvReader = $sampleDataContext->getCsvReader();
@@ -79,6 +87,7 @@ public function __construct(
7987
$this->appCollectionFactory = $appCollectionFactory;
8088
$this->categoryFactory = $categoryFactory;
8189
$this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Json::class);
90+
$this->appState = $appState ?: \Magento\Framework\App\ObjectManager::getInstance()->get(State::class);
8291
}
8392

8493
/**
@@ -163,7 +172,10 @@ public function install(array $fixtures)
163172
->setStoreIds([\Magento\Store\Model\Store::DEFAULT_STORE_ID])
164173
->setWidgetParameters(['block_id' => $block->getId()])
165174
->setPageGroups([$pageGroup]);
166-
$widgetInstance->save();
175+
$this->appState->emulateAreaCode(
176+
'frontend',
177+
[$widgetInstance, 'save']
178+
);
167179
}
168180
}
169181
}

0 commit comments

Comments
 (0)