Skip to content

Commit 3dba110

Browse files
committed
ACP2E-2990: Customer "created_at" date Not Converted to store time zone upon export
- Fixed the CR comments.
1 parent 2ae9ebc commit 3dba110

File tree

2 files changed

+20
-8
lines changed
  • app/code/Magento/CustomerImportExport/Model/Export
  • dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export

2 files changed

+20
-8
lines changed

app/code/Magento/CustomerImportExport/Model/Export/Customer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@ class Customer extends \Magento\ImportExport\Model\Export\Entity\AbstractEav
2121
* Names that begins with underscore is not an attribute. This name convention is for
2222
* to avoid interference with same attribute name.
2323
*/
24-
const COLUMN_EMAIL = 'email';
24+
private const COLUMN_EMAIL = 'email';
2525

26-
const COLUMN_WEBSITE = '_website';
26+
private const COLUMN_WEBSITE = '_website';
2727

28-
const COLUMN_STORE = '_store';
28+
private const COLUMN_STORE = '_store';
2929

3030
private const COLUMN_CREATED_AT = 'created_at';
3131

3232
/**
33-
* Attribute collection name
33+
* A constant declaration for attribute collection name
3434
*/
35-
const ATTRIBUTE_COLLECTION_NAME = \Magento\Customer\Model\ResourceModel\Attribute\Collection::class;
35+
private const ATTRIBUTE_COLLECTION_NAME = \Magento\Customer\Model\ResourceModel\Attribute\Collection::class;
3636

3737
/**
3838
* XML path to page size parameter
3939
*/
40-
const XML_PATH_PAGE_SIZE = 'export/customer_page_size/customer';
40+
private const XML_PATH_PAGE_SIZE = 'export/customer_page_size/customer';
4141

4242
/**
4343
* @var array
@@ -141,7 +141,7 @@ protected function _getEntityCollection()
141141
}
142142

143143
/**
144-
* {@inheritdoc}
144+
* @inheritdoc
145145
*/
146146
protected function _getHeaderColumns()
147147
{
@@ -161,7 +161,7 @@ public function exportItem($item)
161161
$row[self::COLUMN_WEBSITE] = $this->_websiteIdToCode[$item->getWebsiteId()];
162162
$row[self::COLUMN_STORE] = $this->_storeIdToCode[$item->getStoreId()];
163163
$row[self::COLUMN_CREATED_AT] = $this->_localeDate->formatDate(
164-
$row[self::COLUMN_CREATED_AT],
164+
$item->getCreatedAt(),
165165
\IntlDateFormatter::MEDIUM,
166166
true
167167
);

dev/tests/integration/testsuite/Magento/CustomerImportExport/Model/Export/CustomerTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Magento\Customer\Model\Customer as CustomerModel;
1818
use Magento\Customer\Model\ResourceModel\Attribute\Collection;
1919
use Magento\Customer\Model\ResourceModel\Customer\Collection as CustomerCollection;
20+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
2021

2122
/**
2223
* Tests for customer export model.
@@ -50,6 +51,11 @@ class CustomerTest extends \PHPUnit\Framework\TestCase
5051
*/
5152
private $attributeCollection;
5253

54+
/**
55+
* @var TimezoneInterface
56+
*/
57+
private $localeDate;
58+
5359
/**
5460
* @inheritdoc
5561
*/
@@ -58,6 +64,7 @@ protected function setUp(): void
5864
$this->objectManager = Bootstrap::getObjectManager();
5965
$this->_model = $this->objectManager->create(Customer::class);
6066
$this->attributeCollection = $this->objectManager->create(Collection::class);
67+
$this->localeDate = $this->objectManager->create(TimezoneInterface::class);
6168
}
6269

6370
/**
@@ -153,6 +160,11 @@ private function checkExportData(array $lines, array $expectedAttributes): void
153160
$customers = $this->objectManager->create(CustomerCollection::class);
154161
foreach ($customers as $customer) {
155162
$data = $this->processCustomerData($customer, $expectedAttributes);
163+
$data['created_at'] = $this->localeDate->formatDate(
164+
$data['created_at'],
165+
\IntlDateFormatter::MEDIUM,
166+
true
167+
);
156168
$exportData = $lines['data'][$data['email']];
157169
$exportData = $this->unsetDuplicateData($exportData);
158170

0 commit comments

Comments
 (0)