Skip to content

Commit c943561

Browse files
committed
MAGETWO-50831: Impossible specify Bundle option title on store view level
1 parent 058bc54 commit c943561

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

app/code/Magento/Bundle/Model/Product/SaveHandler.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,12 @@ private function getOptionIds(array $options): array
139139
{
140140
$optionIds = [];
141141

142-
if (empty($options)) {
143-
return $optionIds;
144-
}
145-
146-
/** @var \Magento\Bundle\Api\Data\OptionInterface $option */
147-
foreach ($options as $option) {
148-
if ($option->getOptionId()) {
149-
$optionIds[] = $option->getOptionId();
142+
if (!empty($options)) {
143+
/** @var \Magento\Bundle\Api\Data\OptionInterface $option */
144+
foreach ($options as $option) {
145+
if ($option->getOptionId()) {
146+
$optionIds[] = $option->getOptionId();
147+
}
150148
}
151149
}
152150

dev/tests/integration/testsuite/Magento/Bundle/Model/Product/SaveHandlerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ protected function setUp()
4646
$this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
4747
}
4848

49-
public function testOptionTitlesOnDifferentStores()
49+
/**
50+
* @return void
51+
*/
52+
public function testOptionTitlesOnDifferentStores(): void
5053
{
5154
/**
5255
* @var \Magento\Bundle\Model\Product\OptionList $optionList

dev/tests/integration/testsuite/Magento/BundleImportExport/Model/Export/RowCustomizerTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class RowCustomizerTest extends \PHPUnit\Framework\TestCase
2020
*/
2121
private $objectManager;
2222

23+
/**
24+
* @inheritdoc
25+
*/
2326
protected function setUp()
2427
{
2528
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
@@ -30,8 +33,10 @@ protected function setUp()
3033

3134
/**
3235
* @magentoDataFixture Magento/Bundle/_files/product.php
36+
*
37+
* @return void
3338
*/
34-
public function testPrepareData()
39+
public function testPrepareData(): void
3540
{
3641
$parsedAdditionalAttributes = 'text_attribute=!@#$%^&*()_+1234567890-=|\\:;"\'<,>.?/'
3742
. ',text_attribute2=,';
@@ -61,13 +66,15 @@ public function testPrepareData()
6166
* @magentoDataFixture Magento/Store/_files/second_store.php
6267
* @magentoDataFixture Magento/Bundle/_files/product.php
6368
* @magentoDbIsolation disabled
69+
*
70+
* @return void
6471
*/
65-
public function testPrepareDataWithDifferentStoreValues()
72+
public function testPrepareDataWithDifferentStoreValues(): void
6673
{
6774
$storeCode = 'default';
6875
$expectedNames = [
6976
'name' => 'Bundle Product Items',
70-
'name_' . $storeCode => 'Bundle Product Items_' . $storeCode
77+
'name_' . $storeCode => 'Bundle Product Items_' . $storeCode,
7178
];
7279
$parsedAdditionalAttributes = 'text_attribute=!@#$%^&*()_+1234567890-=|\\:;"\'<,>.?/'
7380
. ',text_attribute2=,';
@@ -94,14 +101,16 @@ public function testPrepareDataWithDifferentStoreValues()
94101
$bundleValues = array_map(
95102
function ($input) {
96103
$data = explode('=', $input);
104+
97105
return [$data[0] => $data[1]];
98106
},
99107
explode(',', $result['bundle_values'])
100108
);
101109
$actualNames = [
102110
'name' => array_column($bundleValues, 'name')[0],
103-
'name' . '_' . $store->getCode() => array_column($bundleValues, 'name' . '_' . $store->getCode())[0]
111+
'name' . '_' . $store->getCode() => array_column($bundleValues, 'name' . '_' . $store->getCode())[0],
104112
];
113+
105114
self::assertSame($expectedNames, $actualNames);
106115
}
107116
}

0 commit comments

Comments
 (0)