Skip to content

Commit 108714d

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-60248' into 2.1-develop-pr1
2 parents e110bb5 + 093a625 commit 108714d

File tree

3 files changed

+48
-99
lines changed
  • app/code/Magento/Customer
  • dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product

3 files changed

+48
-99
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
use Magento\Customer\Model\Metadata\Form;
1414
use Magento\Framework\Exception\LocalizedException;
1515

16-
/**
17-
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18-
*/
16+
1917
class Save extends \Magento\Customer\Controller\Adminhtml\Index
2018
{
2119
/**
@@ -81,6 +79,7 @@ protected function _extractData(
8179
) {
8280
$metadataForm = $metadataForm ? $metadataForm : $this->getMetadataForm($entityType, $formCode, $scope);
8381
$formData = $metadataForm->extractData($request, $scope);
82+
$formData = $metadataForm->compactData($formData);
8483

8584
// Initialize additional attributes
8685
/** @var \Magento\Framework\DataObject $object */
@@ -90,11 +89,6 @@ protected function _extractData(
9089
$formData[$attributeCode] = isset($requestData[$attributeCode]) ? $requestData[$attributeCode] : false;
9190
}
9291

93-
$result = $metadataForm->compactData($formData);
94-
95-
// Re-initialize additional attributes
96-
$formData = array_replace($formData, $result);
97-
9892
// Unset unused attributes
9993
$formAttributes = $metadataForm->getAttributes();
10094
foreach ($formAttributes as $attribute) {

app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php

Lines changed: 33 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -302,33 +302,28 @@ public function testExecuteWithExistentCustomer()
302302
],
303303
'subscription' => $subscription,
304304
];
305-
$filteredData = [
305+
$extractedData = [
306306
'entity_id' => $customerId,
307307
'code' => 'value',
308308
'coolness' => false,
309309
'disable_auto_group_change' => 'false',
310310
];
311-
$dataToCompact = [
311+
$compactedData = [
312312
'entity_id' => $customerId,
313313
'code' => 'value',
314314
'coolness' => false,
315315
'disable_auto_group_change' => 'false',
316-
CustomerInterface::DEFAULT_BILLING => false,
317-
CustomerInterface::DEFAULT_SHIPPING => false,
318-
'confirmation' => false,
319-
'sendemail_store_id' => false,
320-
'extension_attributes' => false,
316+
CustomerInterface::DEFAULT_BILLING => 2,
317+
CustomerInterface::DEFAULT_SHIPPING => 2
321318
];
322-
$addressFilteredData = [
319+
$addressExtractedData = [
323320
'entity_id' => $addressId,
324-
'default_billing' => 'true',
325-
'default_shipping' => 'true',
326321
'code' => 'value',
327322
'coolness' => false,
328323
'region' => 'region',
329324
'region_id' => 'region_id',
330325
];
331-
$addressDataToCompact = [
326+
$addressCompactedData = [
332327
'entity_id' => $addressId,
333328
'default_billing' => 'true',
334329
'default_shipping' => 'true',
@@ -428,11 +423,11 @@ public function testExecuteWithExistentCustomer()
428423
$customerFormMock->expects($this->once())
429424
->method('extractData')
430425
->with($this->requestMock, 'customer')
431-
->willReturn($filteredData);
426+
->willReturn($extractedData);
432427
$customerFormMock->expects($this->once())
433428
->method('compactData')
434-
->with($dataToCompact)
435-
->willReturn($filteredData);
429+
->with($extractedData)
430+
->willReturn($compactedData);
436431
$customerFormMock->expects($this->once())
437432
->method('getAttributes')
438433
->willReturn($attributes);
@@ -443,11 +438,11 @@ public function testExecuteWithExistentCustomer()
443438
$customerAddressFormMock->expects($this->once())
444439
->method('extractData')
445440
->with($this->requestMock, 'address/' . $addressId)
446-
->willReturn($addressFilteredData);
441+
->willReturn($addressExtractedData);
447442
$customerAddressFormMock->expects($this->once())
448443
->method('compactData')
449-
->with($addressDataToCompact)
450-
->willReturn($addressFilteredData);
444+
->with($addressExtractedData)
445+
->willReturn($addressCompactedData);
451446
$customerAddressFormMock->expects($this->once())
452447
->method('getAttributes')
453448
->willReturn($attributes);
@@ -635,33 +630,13 @@ public function testExecuteWithNewCustomer()
635630
],
636631
'subscription' => $subscription,
637632
];
638-
$filteredData = [
633+
$extractedData = [
639634
'coolness' => false,
640635
'disable_auto_group_change' => 'false',
641636
];
642-
$dataToCompact = [
643-
'coolness' => false,
644-
'disable_auto_group_change' => 'false',
645-
CustomerInterface::DEFAULT_BILLING => false,
646-
CustomerInterface::DEFAULT_SHIPPING => false,
647-
'confirmation' => false,
648-
'sendemail_store_id' => false,
649-
'extension_attributes' => false,
650-
];
651-
$addressFilteredData = [
637+
$addressExtractedData = [
652638
'entity_id' => $addressId,
653-
'default_billing' => 'false',
654-
'default_shipping' => 'false',
655-
'code' => 'value',
656-
'coolness' => false,
657-
'region' => 'region',
658-
'region_id' => 'region_id',
659-
];
660-
$addressDataToCompact = [
661-
'entity_id' => $addressId,
662-
'default_billing' => 'false',
663-
'default_shipping' => 'false',
664-
'code' => 'value',
639+
'code' => 'value',
665640
'coolness' => false,
666641
'region' => 'region',
667642
'region_id' => 'region_id',
@@ -739,11 +714,11 @@ public function testExecuteWithNewCustomer()
739714
$customerFormMock->expects($this->once())
740715
->method('extractData')
741716
->with($this->requestMock, 'customer')
742-
->willReturn($filteredData);
717+
->willReturn($extractedData);
743718
$customerFormMock->expects($this->once())
744719
->method('compactData')
745-
->with($dataToCompact)
746-
->willReturn($filteredData);
720+
->with($extractedData)
721+
->willReturn($extractedData);
747722
$customerFormMock->expects($this->once())
748723
->method('getAttributes')
749724
->willReturn($attributes);
@@ -754,11 +729,11 @@ public function testExecuteWithNewCustomer()
754729
$customerAddressFormMock->expects($this->once())
755730
->method('extractData')
756731
->with($this->requestMock, 'address/' . $addressId)
757-
->willReturn($addressFilteredData);
732+
->willReturn($addressExtractedData);
758733
$customerAddressFormMock->expects($this->once())
759734
->method('compactData')
760-
->with($addressDataToCompact)
761-
->willReturn($addressFilteredData);
735+
->with($addressExtractedData)
736+
->willReturn($addressExtractedData);
762737
$customerAddressFormMock->expects($this->once())
763738
->method('getAttributes')
764739
->willReturn($attributes);
@@ -912,19 +887,10 @@ public function testExecuteWithNewCustomerAndValidationException()
912887
],
913888
'subscription' => $subscription,
914889
];
915-
$filteredData = [
890+
$extractedData = [
916891
'coolness' => false,
917892
'disable_auto_group_change' => 'false',
918893
];
919-
$dataToCompact = [
920-
'coolness' => false,
921-
'disable_auto_group_change' => 'false',
922-
CustomerInterface::DEFAULT_BILLING => false,
923-
CustomerInterface::DEFAULT_SHIPPING => false,
924-
'confirmation' => false,
925-
'sendemail_store_id' => false,
926-
'extension_attributes' => false,
927-
];
928894

929895
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
930896
$attributeMock = $this->getMockBuilder('Magento\Customer\Api\Data\AttributeMetadataInterface')
@@ -973,11 +939,11 @@ public function testExecuteWithNewCustomerAndValidationException()
973939
$customerFormMock->expects($this->once())
974940
->method('extractData')
975941
->with($this->requestMock, 'customer')
976-
->willReturn($filteredData);
942+
->willReturn($extractedData);
977943
$customerFormMock->expects($this->once())
978944
->method('compactData')
979-
->with($dataToCompact)
980-
->willReturn($filteredData);
945+
->with($extractedData)
946+
->willReturn($extractedData);
981947
$customerFormMock->expects($this->once())
982948
->method('getAttributes')
983949
->willReturn($attributes);
@@ -1064,18 +1030,9 @@ public function testExecuteWithNewCustomerAndLocalizedException()
10641030
],
10651031
'subscription' => $subscription,
10661032
];
1067-
$filteredData = [
1068-
'coolness' => false,
1069-
'disable_auto_group_change' => 'false',
1070-
];
1071-
$dataToCompact = [
1033+
$extractedData = [
10721034
'coolness' => false,
10731035
'disable_auto_group_change' => 'false',
1074-
CustomerInterface::DEFAULT_BILLING => false,
1075-
CustomerInterface::DEFAULT_SHIPPING => false,
1076-
'confirmation' => false,
1077-
'sendemail_store_id' => false,
1078-
'extension_attributes' => false,
10791036
];
10801037

10811038
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
@@ -1126,11 +1083,11 @@ public function testExecuteWithNewCustomerAndLocalizedException()
11261083
$customerFormMock->expects($this->once())
11271084
->method('extractData')
11281085
->with($this->requestMock, 'customer')
1129-
->willReturn($filteredData);
1086+
->willReturn($extractedData);
11301087
$customerFormMock->expects($this->once())
11311088
->method('compactData')
1132-
->with($dataToCompact)
1133-
->willReturn($filteredData);
1089+
->with($extractedData)
1090+
->willReturn($extractedData);
11341091
$customerFormMock->expects($this->once())
11351092
->method('getAttributes')
11361093
->willReturn($attributes);
@@ -1216,19 +1173,10 @@ public function testExecuteWithNewCustomerAndException()
12161173
],
12171174
'subscription' => $subscription,
12181175
];
1219-
$filteredData = [
1176+
$extractedData = [
12201177
'coolness' => false,
12211178
'disable_auto_group_change' => 'false',
12221179
];
1223-
$dataToCompact = [
1224-
'coolness' => false,
1225-
'disable_auto_group_change' => 'false',
1226-
CustomerInterface::DEFAULT_BILLING => false,
1227-
CustomerInterface::DEFAULT_SHIPPING => false,
1228-
'confirmation' => false,
1229-
'sendemail_store_id' => false,
1230-
'extension_attributes' => false,
1231-
];
12321180

12331181
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
12341182
$attributeMock = $this->getMockBuilder('Magento\Customer\Api\Data\AttributeMetadataInterface')
@@ -1277,11 +1225,11 @@ public function testExecuteWithNewCustomerAndException()
12771225
$customerFormMock->expects($this->once())
12781226
->method('extractData')
12791227
->with($this->requestMock, 'customer')
1280-
->willReturn($filteredData);
1228+
->willReturn($extractedData);
12811229
$customerFormMock->expects($this->once())
12821230
->method('compactData')
1283-
->with($dataToCompact)
1284-
->willReturn($filteredData);
1231+
->with($extractedData)
1232+
->willReturn($extractedData);
12851233
$customerFormMock->expects($this->once())
12861234
->method('getAttributes')
12871235
->willReturn($attributes);

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,12 +567,19 @@ public function clickBaseImage()
567567
*/
568568
public function closeFullImage()
569569
{
570-
$element = $this->browser->find($this->fullImageClose, Locator::SELECTOR_CSS);
571-
if (!$element->isVisible()) {
572-
$element->hover();
573-
$this->waitForElementVisible($this->fullImageClose);
574-
}
575-
$element->click();
570+
$this->_rootElement->waitUntil(
571+
function () {
572+
$this->browser->find($this->fullImage)->hover();
573+
574+
if ($this->browser->find($this->fullImageClose)->isVisible()) {
575+
$this->browser->find($this->fullImageClose)->click();
576+
577+
return true;
578+
}
579+
580+
return null;
581+
}
582+
);
576583
}
577584

578585
/**

0 commit comments

Comments
 (0)