Skip to content

Commit 8b4d40b

Browse files
author
nsyvokonenko
committed
Merge remote-tracking branch 'origin/MAGETWO-28011' into MAGETWO-28011
2 parents 0cb5ea5 + 9084182 commit 8b4d40b

File tree

5 files changed

+24
-43
lines changed

5 files changed

+24
-43
lines changed

app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ protected function _construct()
9191
$this->_queueLinkTable = $this->getTable('newsletter_queue_link');
9292
$this->_storeTable = $this->getTable('store');
9393

94-
// defining mapping for fields represented in several tables
95-
$this->_map['fields']['customer_lastname'] = 'customer_lastname_table.value';
96-
$this->_map['fields']['customer_firstname'] = 'customer_firstname_table.value';
9794
$this->_map['fields']['type'] = $this->getResource()->getReadConnection()->getCheckSql(
9895
'main_table.customer_id = 0',
9996
1,
@@ -145,37 +142,16 @@ public function useOnlyUnsent()
145142
*/
146143
public function showCustomerInfo()
147144
{
148-
$adapter = $this->getConnection();
149-
150-
$lastNameData = $this->_customerHelperData->getAttributeMetadata(
151-
\Magento\Customer\Api\CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
152-
'lastname'
153-
);
154-
$firstNameData = $this->_customerHelperData->getAttributeMetadata(
155-
\Magento\Customer\Api\CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
156-
'firstname'
145+
$this->getSelect()->joinLeft(
146+
[
147+
'customer' => $this->getTable('customer_entity')
148+
],
149+
'main_table.customer_id',
150+
[
151+
'customer_lastname' => 'lastname',
152+
'customer_firstname' => 'firstname'
153+
]
157154
);
158-
159-
$this->getSelect()
160-
->joinLeft(
161-
['customer_lastname_table' => $lastNameData['attribute_table']],
162-
$adapter->quoteInto(
163-
'customer_lastname_table.entity_id=main_table.customer_id
164-
AND customer_lastname_table.attribute_id = ?',
165-
(int)$lastNameData['attribute_id']
166-
),
167-
['customer_lastname' => 'value']
168-
)
169-
->joinLeft(
170-
['customer_firstname_table' => $firstNameData['attribute_table']],
171-
$adapter->quoteInto(
172-
'customer_firstname_table.entity_id=main_table.customer_id
173-
AND customer_firstname_table.attribute_id = ?',
174-
(int)$firstNameData['attribute_id']
175-
),
176-
['customer_firstname' => 'value']
177-
);
178-
179155
return $this;
180156
}
181157

app/code/Magento/Quote/Model/Observer/Frontend/Quote/Address/CollectTotals.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ public function dispatch(\Magento\Framework\Event\Observer $observer)
7373
$customer = $quote->getCustomer();
7474
$storeId = $customer->getStoreId();
7575

76-
if (($customer->getCustomAttribute('disable_auto_group_change')
77-
&& $customer->getCustomAttribute('disable_auto_group_change')->getValue())
76+
if ($customer->getDisableAutoGroupChange()
7877
|| false == $this->vatValidator->isEnabled($quoteAddress, $storeId)
7978
) {
8079
return;
8180
}
82-
8381
$customerCountryCode = $quoteAddress->getCountryId();
8482
$customerVatNumber = $quoteAddress->getVatId();
8583
$groupId = null;

dev/tests/api-functional/testsuite/Magento/Customer/Api/AccountManagementCustomAttributesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ public function testUpdateCustomerWithImageAttribute()
270270
$mediaDirectory = $this->fileSystem->getDirectoryWrite(DirectoryList::MEDIA);
271271
$customerMediaPath = $mediaDirectory->getAbsolutePath(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER);
272272
$previousImagePath =
273-
$previousCustomerData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES][1][AttributeValue::VALUE];
273+
$previousCustomerData[CustomAttributesDataInterface::CUSTOM_ATTRIBUTES][0][AttributeValue::VALUE];
274274
$this->assertFalse(file_exists($customerMediaPath . $previousImagePath));
275275
}
276276
}

dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getAttributeMetadataDataProvider()
8080
AttributeMetadata::NOTE => '',
8181
AttributeMetadata::SYSTEM => true,
8282
AttributeMetadata::USER_DEFINED => false,
83-
AttributeMetadata::BACKEND_TYPE => 'varchar',
83+
AttributeMetadata::BACKEND_TYPE => 'static',
8484
AttributeMetadata::SORT_ORDER => 40
8585
],
8686
],
@@ -106,7 +106,7 @@ public function getAttributeMetadataDataProvider()
106106
AttributeMetadata::NOTE => '',
107107
AttributeMetadata::SYSTEM => false,
108108
AttributeMetadata::USER_DEFINED => false,
109-
AttributeMetadata::BACKEND_TYPE => 'int',
109+
AttributeMetadata::BACKEND_TYPE => 'static',
110110
AttributeMetadata::SORT_ORDER => 110
111111
],
112112
],
@@ -187,9 +187,8 @@ public function testGetCustomAttributesMetadata()
187187

188188
$attributeMetadata = $this->_webApiCall($serviceInfo);
189189

190-
//Default custom attribute code 'disable_auto_group_change'
191-
$this->assertCount(1, $attributeMetadata);
192-
$this->assertEquals('disable_auto_group_change', $attributeMetadata[0]['attribute_code']);
190+
// There are no default custom attributes.
191+
$this->assertCount(0, $attributeMetadata);
193192
}
194193

195194
/**

dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfoTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,15 @@ public function tearDown()
9595
*/
9696
public function testGetCustomer()
9797
{
98-
$this->assertEquals($this->_loadCustomer(), $this->_block->getCustomer());
98+
$expectedCustomer = $this->_loadCustomer();
99+
$actualCustomer = $this->_block->getCustomer();
100+
$this->assertEquals(count($expectedCustomer->__toArray()), count($actualCustomer->__toArray()));
101+
foreach ($expectedCustomer->__toArray() as $property => $value) {
102+
$expectedValue = is_numeric($value) ? intval($value) : $value;
103+
$actualValue = $actualCustomer->__toArray()[$property];
104+
$actualValue = is_numeric($actualValue) ? intval($actualValue) : $actualValue;
105+
$this->assertEquals($expectedValue, $actualValue);
106+
}
99107
}
100108

101109
public function testGetCustomerEmpty()

0 commit comments

Comments
 (0)