Skip to content

Commit 92be800

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-86480' into 2.2-develop-pr36
2 parents 0ac903e + 369fd1d commit 92be800

File tree

25 files changed

+342
-124
lines changed

25 files changed

+342
-124
lines changed

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<section name="ProductInWebsitesSection">
3434
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
3535
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
36+
<element name="isWebsiteDisabled" type="checkbox" selector="//label[contains(text(), '{{websiteName}}')]/parent::div//input[@type='checkbox' and @disabled]" parameterized="true"/>
3637
</section>
3738
<section name="ProductWYSIWYGSection">
3839
<element name="Switcher" type="button" selector="//select[@id='dropdown-switcher']"/>

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AbstractModifierTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ protected function setUp()
6363
'getAttributes',
6464
'getStore',
6565
'getAttributeDefaultValue',
66-
'getExistsStoreValueFlag'
66+
'getExistsStoreValueFlag',
67+
'isLockedAttribute'
6768
])->getMockForAbstractClass();
6869
$this->storeMock = $this->getMockBuilder(StoreInterface::class)
6970
->setMethods(['load', 'getId', 'getConfig'])
@@ -81,9 +82,6 @@ protected function setUp()
8182
$this->arrayManagerMock->expects($this->any())
8283
->method('set')
8384
->willReturnArgument(1);
84-
$this->arrayManagerMock->expects($this->any())
85-
->method('merge')
86-
->willReturnArgument(1);
8785
$this->arrayManagerMock->expects($this->any())
8886
->method('remove')
8987
->willReturnArgument(1);

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/AttributeSetTest.php

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Catalog\Test\Unit\Ui\DataProvider\Product\Form\Modifier;
77

8+
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
89
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AttributeSet;
910
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory;
1011
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection;
@@ -84,7 +85,34 @@ protected function createModel()
8485

8586
public function testModifyMeta()
8687
{
87-
$this->assertNotEmpty($this->getModel()->modifyMeta(['test_group' => []]));
88+
$modifyMeta = $this->getModel()->modifyMeta(['test_group' => []]);
89+
$this->assertNotEmpty($modifyMeta);
90+
}
91+
92+
/**
93+
* @param bool $locked
94+
* @return void
95+
* @dataProvider modifyMetaLockedDataProvider
96+
*/
97+
public function testModifyMetaLocked(bool $locked)
98+
{
99+
$this->productMock->expects($this->any())
100+
->method('isLockedAttribute')
101+
->willReturn($locked);
102+
$modifyMeta = $this->getModel()->modifyMeta([AbstractModifier::DEFAULT_GENERAL_PANEL => []]);
103+
$children = $modifyMeta[AbstractModifier::DEFAULT_GENERAL_PANEL]['children'];
104+
$this->assertEquals(
105+
$locked,
106+
$children['attribute_set_id']['arguments']['data']['config']['disabled']
107+
);
108+
}
109+
110+
/**
111+
* @return array
112+
*/
113+
public function modifyMetaLockedDataProvider()
114+
{
115+
return [[true], [false]];
88116
}
89117

90118
public function testModifyMetaToBeEmpty()

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/CategoriesTest.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,48 @@ public function testModifyMeta()
114114
$this->assertArrayHasKey($groupCode, $this->getModel()->modifyMeta($meta));
115115
}
116116

117+
/**
118+
* @param bool $locked
119+
* @return void
120+
* @dataProvider modifyMetaLockedDataProvider
121+
*/
122+
public function testModifyMetaLocked(bool $locked)
123+
{
124+
$groupCode = 'test_group_code';
125+
$meta = [
126+
$groupCode => [
127+
'children' => [
128+
'category_ids' => [
129+
'sortOrder' => 10,
130+
],
131+
],
132+
],
133+
];
134+
135+
$this->arrayManagerMock->expects($this->any())
136+
->method('findPath')
137+
->willReturn('path');
138+
139+
$this->productMock->expects($this->any())
140+
->method('isLockedAttribute')
141+
->willReturn($locked);
142+
143+
$this->arrayManagerMock->expects($this->any())
144+
->method('merge')
145+
->willReturnArgument(2);
146+
147+
$modifyMeta = $this->createModel()->modifyMeta($meta);
148+
$this->assertEquals($locked, $modifyMeta['arguments']['data']['config']['disabled']);
149+
}
150+
151+
/**
152+
* @return array
153+
*/
154+
public function modifyMetaLockedDataProvider()
155+
{
156+
return [[true], [false]];
157+
}
158+
117159
public function testModifyMetaWithCaching()
118160
{
119161
$this->arrayManagerMock->expects($this->exactly(2))

0 commit comments

Comments
 (0)