Skip to content

Commit bcec239

Browse files
committed
MAGETWO-84209: Impossible specify Bundle option title on store view level
1 parent 9aa66d5 commit bcec239

File tree

2 files changed

+80
-1
lines changed

2 files changed

+80
-1
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Model\Product;
8+
9+
/**
10+
* Test class for \Magento\Bundle\Model\Product\SaveHandler
11+
* The tested class used indirectly
12+
*
13+
* @magentoDataFixture Magento/Bundle/_files/product.php
14+
* @magentoDataFixture Magento/Store/_files/second_website_with_two_stores.php
15+
* @magentoDbIsolation disabled
16+
* @magentoAppIsolation enabled
17+
*/
18+
class SaveHandlerTest extends \PHPUnit\Framework\TestCase
19+
{
20+
/**
21+
* @var \Magento\Framework\ObjectManagerInterface
22+
*/
23+
private $objectManager;
24+
25+
/**
26+
* @var \Magento\Store\Model\Store
27+
*/
28+
private $store;
29+
30+
/**
31+
* @var \Magento\Catalog\Api\ProductRepositoryInterface
32+
*/
33+
private $productRepository;
34+
35+
protected function setUp()
36+
{
37+
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
38+
$this->store = $this->objectManager->create(\Magento\Store\Model\Store::class);
39+
/** @var \Magento\Catalog\Api\ProductRepositoryInterface $productRepository */
40+
$this->productRepository = $this->objectManager->create(\Magento\Catalog\Api\ProductRepositoryInterface::class);
41+
}
42+
43+
public function testOptionTitlesOnDifferentStores()
44+
{
45+
/**
46+
* @var \Magento\Bundle\Model\Product\OptionList $optionList
47+
*/
48+
$optionList = $this->objectManager->create(\Magento\Bundle\Model\Product\OptionList::class);
49+
50+
$secondStoreId = $this->store->load('fixture_second_store')->getId();
51+
$thirdStoreId = $this->store->load('fixture_third_store')->getId();
52+
53+
$product = $this->productRepository->get('bundle-product', true, $secondStoreId, true);
54+
$options = $optionList->getItems($product);
55+
$title = $options[0]->getTitle();
56+
$newTitle = $title . ' ' . $this->store->load('fixture_second_store')->getCode();
57+
$options[0]->setTitle($newTitle);
58+
$extension = $product->getExtensionAttributes();
59+
$extension->setBundleProductOptions($options);
60+
$product->setExtensionAttributes($extension);
61+
$product->save();
62+
63+
$product = $this->productRepository->get('bundle-product', true, $thirdStoreId, true);
64+
$options = $optionList->getItems($product);
65+
$newTitle = $title . ' ' . $this->store->load('fixture_third_store')->getCode();
66+
$options[0]->setTitle($newTitle);
67+
$extension = $product->getExtensionAttributes();
68+
$extension->setBundleProductOptions($options);
69+
$product->setExtensionAttributes($extension);
70+
$product->save();
71+
72+
$product = $this->productRepository->get('bundle-product', false, $secondStoreId, true);
73+
$options = $optionList->getItems($product);
74+
$this->assertEquals(1, count($options));
75+
$this->assertEquals(
76+
$title . ' ' . $this->store->load('fixture_second_store')->getCode(),
77+
$options[0]->getTitle()
78+
);
79+
}
80+
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public function testPrepareData()
6464
*/
6565
public function testPrepareDataWithDifferentStoreValues()
6666
{
67-
$this->markTestSkipped('Test is blocked by MAGETWO-84209.');
6867
$storeCode = 'default';
6968
$expectedNames = [
7069
'name' => 'Bundle Product Items',

0 commit comments

Comments
 (0)