Skip to content

Commit 5bb0cd8

Browse files
author
tpogrebniak
committed
Merge branch 'develop' of github.corp.ebay.com:magento2/magento2ce into develop
2 parents 381277d + 4985ace commit 5bb0cd8

File tree

92 files changed

+2037
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2037
-401
lines changed

app/code/Magento/Bundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"magento/module-media-storage": "1.0.0-beta"
2121
},
2222
"suggest": {
23-
"magento/module-webapi": "1.0.0-beta"
23+
"magento/module-webapi": "1.0.0-beta",
24+
"magento/module-bundle-sample-data": "Sample Data version:1.0.0-beta"
2425
},
2526
"type": "magento2-module",
2627
"version": "1.0.0-beta",

app/code/Magento/Catalog/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"magento/module-ui": "self.version"
3131
},
3232
"suggest": {
33-
"magento/module-cookie": "1.0.0-beta"
33+
"magento/module-cookie": "1.0.0-beta",
34+
"magento/module-catalog-sample-data": "Sample Data version:1.0.0-beta"
3435
},
3536
"type": "magento2-module",
3637
"version": "1.0.0-beta",

app/code/Magento/CatalogImportExport/Model/Import/Product/Type/AbstractType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,9 @@ public function prepareAttributesWithDefaultValueForSave(array $rowData, $withDe
480480
foreach ($this->_getProductAttributes($rowData) as $attrCode => $attrParams) {
481481
if (!$attrParams['is_static']) {
482482
if (isset($rowData[$attrCode]) && strlen($rowData[$attrCode])) {
483-
$resultAttrs[$attrCode] = 'select' == $attrParams['type'] ? $attrParams['options'][strtolower(
484-
$rowData[$attrCode]
485-
)] : $rowData[$attrCode];
483+
$resultAttrs[$attrCode] = in_array($attrParams['type'], ['select', 'boolean'])
484+
? $attrParams['options'][strtolower($rowData[$attrCode])]
485+
: $rowData[$attrCode];
486486
if ('multiselect' == $attrParams['type']) {
487487
$resultAttrs[$attrCode] = [];
488488
foreach (explode(Product::PSEUDO_MULTI_LINE_SEPARATOR, $rowData[$attrCode]) as $value) {

app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
141141
$valid = $this->numericValidation($attrCode, $attrParams['type']);
142142
break;
143143
case 'select':
144+
case 'boolean':
144145
case 'multiselect':
145146
$values = explode(Product::PSEUDO_MULTI_LINE_SEPARATOR, $rowData[$attrCode]);
146147
$valid = true;

app/code/Magento/CatalogImportExport/Model/Import/Uploader.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,12 @@ protected function _moveFile($tmpPath, $destPath)
314314
return false;
315315
}
316316
}
317+
318+
/**
319+
* {@inheritdoc}
320+
*/
321+
protected function chmod($file)
322+
{
323+
return;
324+
}
317325
}

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/Type/AbstractTypeTest.php

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,40 +117,59 @@ protected function setUp()
117117
'',
118118
false
119119
);
120-
121-
$entityAttributes = [[
122-
'attribute_id' => 'attribute_id',
123-
'attribute_set_name' => 'attributeSetName',
124-
]];
125-
126-
$this->entityModel->expects($this->any())->method('getEntityTypeId')->willReturn(3);
127-
$this->entityModel->expects($this->any())->method('getAttributeOptions')->willReturn(['option1', 'option2']);
128-
$attrSetColFactory->expects($this->any())->method('create')->willReturn($attrSetCollection);
129-
$attrSetCollection->expects($this->any())->method('setEntityTypeFilter')->willReturn([$attributeSet]);
130-
$attrColFactory->expects($this->any())->method('create')->willReturn($attrCollection);
131-
$attrCollection->expects($this->any())->method('setAttributeSetFilter')->willReturn([$attribute]);
132-
$attributeSet->expects($this->any())->method('getId')->willReturn(1);
133-
$attributeSet->expects($this->any())->method('getAttributeSetName')->willReturn('attribute_set_name');
134-
$attribute->expects($this->any())->method('getAttributeCode')->willReturn('attr_code');
135-
$attribute->expects($this->any())->method('getId')->willReturn('1');
136120
$attribute->expects($this->any())->method('getIsVisible')->willReturn(true);
137121
$attribute->expects($this->any())->method('getIsGlobal')->willReturn(true);
138122
$attribute->expects($this->any())->method('getIsRequired')->willReturn(true);
139123
$attribute->expects($this->any())->method('getIsUnique')->willReturn(true);
140124
$attribute->expects($this->any())->method('getFrontendLabel')->willReturn('frontend_label');
141-
$attribute->expects($this->any())->method('isStatic')->willReturn(true);
142125
$attribute->expects($this->any())->method('getApplyTo')->willReturn(['simple']);
143126
$attribute->expects($this->any())->method('getDefaultValue')->willReturn('default_value');
144127
$attribute->expects($this->any())->method('usesSource')->willReturn(true);
145-
$attribute->expects($this->any())->method('getFrontendInput')->willReturn('multiselect');
128+
129+
130+
$entityAttributes = [
131+
[
132+
'attribute_id' => 'attribute_id',
133+
'attribute_set_name' => 'attributeSetName',
134+
],
135+
[
136+
'attribute_id' => 'boolean_attribute',
137+
'attribute_set_name' => 'attributeSetName'
138+
]
139+
];
140+
$attribute1 = clone $attribute;
141+
$attribute2 = clone $attribute;
142+
143+
$attribute1->expects($this->any())->method('getId')->willReturn('1');
144+
$attribute1->expects($this->any())->method('getAttributeCode')->willReturn('attr_code');
145+
$attribute1->expects($this->any())->method('getFrontendInput')->willReturn('multiselect');
146+
$attribute1->expects($this->any())->method('isStatic')->willReturn(true);
147+
148+
$attribute2->expects($this->any())->method('getId')->willReturn('2');
149+
$attribute2->expects($this->any())->method('getAttributeCode')->willReturn('boolean_attribute');
150+
$attribute2->expects($this->any())->method('getFrontendInput')->willReturn('boolean');
151+
$attribute2->expects($this->any())->method('isStatic')->willReturn(false);
152+
153+
$this->entityModel->expects($this->any())->method('getEntityTypeId')->willReturn(3);
154+
$this->entityModel->expects($this->any())->method('getAttributeOptions')->willReturnOnConsecutiveCalls(
155+
['option1', 'option2'],
156+
['yes' => 1, 'no' => 0]
157+
);
158+
$attrSetColFactory->expects($this->any())->method('create')->willReturn($attrSetCollection);
159+
$attrSetCollection->expects($this->any())->method('setEntityTypeFilter')->willReturn([$attributeSet]);
160+
$attrColFactory->expects($this->any())->method('create')->willReturn($attrCollection);
161+
$attrCollection->expects($this->any())->method('setAttributeSetFilter')->willReturn([$attribute1, $attribute2]);
162+
$attributeSet->expects($this->any())->method('getId')->willReturn(1);
163+
$attributeSet->expects($this->any())->method('getAttributeSetName')->willReturn('attribute_set_name');
164+
146165
$attrCollection
147166
->expects($this->any())
148167
->method('addFieldToFilter')
149168
->with(
150169
'main_table.attribute_id',
151-
['in' => ['attribute_id']]
170+
['in' => ['attribute_id', 'boolean_attribute']]
152171
)
153-
->willReturn([$attribute]);
172+
->willReturn([$attribute1, $attribute2]);
154173

155174
$this->connection = $this->getMock(
156175
'Magento\Framework\DB\Adapter\Pdo\Mysql',
@@ -343,6 +362,7 @@ public function addAttributeOptionDataProvider()
343362
/**
344363
* @param $object
345364
* @param $property
365+
* @return mixed
346366
*/
347367
protected function getPropertyValue(&$object, $property)
348368
{
@@ -366,4 +386,14 @@ protected function setPropertyValue(&$object, $property, $value)
366386
$reflectionProperty->setValue($object, $value);
367387
return $object;
368388
}
389+
390+
public function testPrepareAttributesWithDefaultValueForSave()
391+
{
392+
$rowData = [
393+
'_attribute_set' => 'attributeSetName',
394+
'boolean_attribute' => 'Yes'
395+
];
396+
$result = $this->simpleType->prepareAttributesWithDefaultValueForSave($rowData);
397+
$this->assertEquals(['boolean_attribute' => 1], $result);
398+
}
369399
}

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/Product/ValidatorTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,25 @@ protected function setUp()
7272
$this->validator->init($this->context);
7373
}
7474

75+
public function testIsBooleanAttributeValid()
76+
{
77+
$this->context->expects($this->any())->method('getBehavior')
78+
->willReturn(\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE);
79+
$result = $this->validator->isAttributeValid(
80+
'boolean_attribute',
81+
[
82+
'type' => 'boolean',
83+
'apply_to' => ['simple'],
84+
'is_required' => false
85+
],
86+
[
87+
'product_type' => 'simple',
88+
'boolean_attribute' => 'Yes'
89+
]
90+
);
91+
$this->assertTrue($result);
92+
}
93+
7594
public function testIsValidCorrect()
7695
{
7796
$value = ['product_type' => 'simple'];

app/code/Magento/CatalogRule/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"magento/framework": "1.0.0-beta"
1313
},
1414
"suggest": {
15-
"magento/module-import-export": "1.0.0-beta"
15+
"magento/module-import-export": "1.0.0-beta",
16+
"magento/module-catalog-rule-sample-data": "Sample Data version:1.0.0-beta"
1617
},
1718
"type": "magento2-module",
1819
"version": "1.0.0-beta",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © 2015 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="catalog_product_save_after">
10+
<observer name="process_url_rewrite_saving" instance="\Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteSavingObserver" method="execute"/>
11+
</event>
12+
</config>

app/code/Magento/Cms/composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"magento/module-media-storage": "1.0.0-beta",
1515
"magento/framework": "1.0.0-beta"
1616
},
17+
"suggest": {
18+
"magento/module-cms-sample-data": "Sample Data version:1.0.0-beta"
19+
},
1720
"type": "magento2-module",
1821
"version": "1.0.0-beta",
1922
"license": [

0 commit comments

Comments
 (0)