Skip to content

Commit 1109bbd

Browse files
committed
Reverted changes not referred to an issue. Added backward compatibility and reverted initial version of unit tests because of backward compatibility (#24726)
1 parent b5692d9 commit 1109bbd

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

app/code/Magento/Catalog/Model/Product/Option.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,24 @@ public function __construct(
158158
$this->validatorPool = $validatorPool;
159159
$this->customOptionValuesFactory = $customOptionValuesFactory ?:
160160
\Magento\Framework\App\ObjectManager::getInstance()->get(ProductCustomOptionValuesInterfaceFactory::class);
161-
$this->optionGroups = $optionGroups;
162-
$this->optionGroupsToTypes = $optionGroupsToTypes;
161+
$this->optionGroups = $optionGroups ?: [
162+
'date' => 'Magento\Catalog\Model\Product\Option\Type\Date',
163+
'file' => 'Magento\Catalog\Model\Product\Option\Type\File',
164+
'select' => 'Magento\Catalog\Model\Product\Option\Type\Select',
165+
'text' => 'Magento\Catalog\Model\Product\Option\Type\Text',
166+
];
167+
$this->optionGroupsToTypes = $optionGroupsToTypes ?: [
168+
'field' => 'text',
169+
'area' => 'text',
170+
'file' => 'file',
171+
'drop_down' => 'select',
172+
'radio' => 'select',
173+
'checkbox' => 'select',
174+
'multiple' => 'select',
175+
'date' => 'date',
176+
'date_time' => 'date',
177+
'time' => 'date',
178+
];
163179

164180
parent::__construct(
165181
$context,

app/code/Magento/Catalog/Test/Unit/Model/Product/OptionTest.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,7 @@ protected function setUp()
2424
{
2525
$this->productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
2626
$objectManager = new ObjectManager($this);
27-
$this->model = $objectManager->getObject(
28-
\Magento\Catalog\Model\Product\Option::class,
29-
[
30-
'optionGroupsToTypes' => [
31-
'field' => 'text',
32-
'drop_down' => 'select',
33-
'file' => 'file',
34-
]
35-
]
36-
);
27+
$this->model = $objectManager->getObject(\Magento\Catalog\Model\Product\Option::class);
3728
$this->model->setProduct($this->productMock);
3829
}
3930

app/code/Magento/Catalog/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
<preference for="Magento\Catalog\Model\Indexer\Product\Price\UpdateIndexInterface" type="Magento\Catalog\Model\Indexer\Product\Price\InvalidateIndex" />
7373
<preference for="Magento\Catalog\Model\Product\Gallery\ImagesConfigFactoryInterface" type="Magento\Catalog\Model\Product\Gallery\ImagesConfigFactory" />
7474
<preference for="Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface" type="Magento\Catalog\Model\Product\Configuration\Item\ItemResolverComposite" />
75+
<preference for="Magento\Catalog\Api\Data\MassActionInterface" type="\Magento\Catalog\Model\MassAction" />
7576
<type name="Magento\Customer\Model\ResourceModel\Visitor">
7677
<plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" />
7778
</type>

0 commit comments

Comments
 (0)