Skip to content

Commit 7c5713b

Browse files
committed
MAGETWO-35175: Impossible to create Configurable product
1 parent f65cbac commit 7c5713b

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Validate.php

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function execute()
9090
if ($storeId) {
9191
$product->setStoreId($storeId);
9292
}
93-
$setId = $this->getRequest()->getPost('set');
93+
$setId = $this->getRequest()->getPost('set') ?: $this->getRequest()->getParam('set');
9494
if ($setId) {
9595
$product->setAttributeSetId($setId);
9696
}

app/code/Magento/Catalog/Test/Unit/Controller/Adminhtml/Product/ValidateTest.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class ValidateTest extends \Magento\Catalog\Test\Unit\Controller\Adminhtml\Produ
2828
protected $initializationHelper;
2929
/** @var \Magento\Catalog\Model\ProductFactory|\PHPUnit_Framework_MockObject_MockObject */
3030
protected $productFactory;
31-
/** @var \Magento\Framework\Controller\Result\JSON|\PHPUnit_Framework_MockObject_MockObject */
31+
/** @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject */
3232
protected $resultJson;
33-
/** @var \Magento\Framework\Controller\Result\JSONFactory|\PHPUnit_Framework_MockObject_MockObject */
33+
/** @var \Magento\Framework\Controller\Result\JsonFactory|\PHPUnit_Framework_MockObject_MockObject */
3434
protected $resultJsonFactory;
3535

3636
protected function setUp()
@@ -104,8 +104,8 @@ protected function setUp()
104104
->getMock();
105105
$this->productFactory->expects($this->any())->method('create')->willReturn($this->product);
106106

107-
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\JSON', [], [], '', false);
108-
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JSONFactory')
107+
$this->resultJson = $this->getMock('Magento\Framework\Controller\Result\Json', [], [], '', false);
108+
$this->resultJsonFactory = $this->getMockBuilder('Magento\Framework\Controller\Result\JsonFactory')
109109
->disableOriginalConstructor()
110110
->setMethods(['create'])
111111
->getMock();
@@ -126,15 +126,21 @@ protected function setUp()
126126
);
127127
}
128128

129-
/**
130-
* @return void
131-
*/
132-
public function testAttributeSetIsObtainedFromPost()
129+
public function testAttributeSetIsObtainedFromPostByDefault()
133130
{
131+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
134132
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, 9]]);
135-
136133
$this->product->expects($this->once())->method('setAttributeSetId')->with(9);
137134

138135
$this->action->execute();
139136
}
137+
138+
public function testAttributeSetIsObtainedFromGetWhenThereIsNoOneInPost()
139+
{
140+
$this->request->expects($this->any())->method('getParam')->willReturnMap([['set', null, 4]]);
141+
$this->request->expects($this->any())->method('getPost')->willReturnMap([['set', null, null]]);
142+
$this->product->expects($this->once())->method('setAttributeSetId')->with(4);
143+
144+
$this->action->execute();
145+
}
140146
}

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CreateConfigurableProductEntityTest extends Injectable
4040
{
4141
/* tags */
4242
const TEST_TYPE = 'acceptance_test';
43-
const STABLE = 'no';
43+
const STABLE = 'yes';
4444
const MVP = 'yes';
4545
const DOMAIN = 'MX';
4646
/* end tags */

dev/tests/functional/tests/app/Magento/ConfigurableProduct/Test/TestCase/CreateConfigurableProductEntityTest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
1010
<testCase name="Magento\ConfigurableProduct\Test\TestCase\CreateConfigurableProductEntityTest">
1111
<variation name="CreateConfigurableProductEntityTestVariation1">
12-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
1312
<data name="description" xsi:type="string">Create product with category and two new options</data>
1413
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
1514
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data>
@@ -55,7 +54,6 @@
5554
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductInCart"/>
5655
</variation>
5756
<variation name="CreateConfigurableProductEntityTestVariation3">
58-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
5957
<data name="description" xsi:type="string">Create product with special price</data>
6058
<data name="product/data/url_key" xsi:type="string">configurable-product-%isolation%</data>
6159
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_new_options</data>
@@ -116,7 +114,6 @@
116114
<constraint name="Magento\ConfigurableProduct\Test\Constraint\AssertConfigurableProductPage" />
117115
</variation>
118116
<variation name="CreateConfigurableProductEntityTestVariation6" firstConstraint="Magento\Catalog\Test\Constraint\AssertProductSaveMessage" method="test">
119-
<data name="issue" xsi:type="string">Bug: MAGETWO-34195</data>
120117
<data name="description" xsi:type="string">MAGETWO-13361: Create Configurable Product with Creating New Category and New Attribute (Required Fields Only)</data>
121118
<data name="product/data/configurable_attributes_data/preset" xsi:type="string">two_searchable_options</data>
122119
<data name="product/data/name" xsi:type="string">Configurable Product %isolation%</data>

0 commit comments

Comments
 (0)