Skip to content

Commit 291ddcf

Browse files
committed
Merge remote-tracking branch 'origin/MC-17925' into 2.3-develop-pr28
2 parents 3dbf7fb + 2c364a3 commit 291ddcf

File tree

5 files changed

+23
-8
lines changed

5 files changed

+23
-8
lines changed

app/code/Magento/Customer/Model/Data/Address.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
}
4343

4444
/**
45-
* {@inheritdoc}
45+
* @inheritdoc
4646
*/
4747
protected function getCustomAttributesCodes()
4848
{
@@ -327,7 +327,7 @@ public function setCompany($company)
327327
*/
328328
public function setTelephone($telephone)
329329
{
330-
return $this->setData(self::TELEPHONE, $telephone);
330+
return $this->setData(self::TELEPHONE, trim($telephone));
331331
}
332332

333333
/**
@@ -452,7 +452,7 @@ public function setIsDefaultBilling($isDefaultBilling)
452452
}
453453

454454
/**
455-
* {@inheritdoc}
455+
* @inheritdoc
456456
*
457457
* @return \Magento\Customer\Api\Data\AddressExtensionInterface|null
458458
*/
@@ -462,7 +462,7 @@ public function getExtensionAttributes()
462462
}
463463

464464
/**
465-
* {@inheritdoc}
465+
* @inheritdoc
466466
*
467467
* @param \Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes
468468
* @return $this

app/code/Magento/Eav/Model/Attribute/Data/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
*/
4646
public function extractValue(RequestInterface $request)
4747
{
48-
$value = $this->_getRequestValue($request);
48+
$value = trim($this->_getRequestValue($request));
4949
return $this->_applyInputFilter($value);
5050
}
5151

@@ -168,7 +168,7 @@ private function validateLength(\Magento\Eav\Model\Attribute $attribute, string
168168
*/
169169
private function validateInputRule(string $value): array
170170
{
171-
$result = $this->_validateInputRule(trim($value));
171+
$result = $this->_validateInputRule($value);
172172
return \is_array($result) ? $result : [];
173173
}
174174
}

app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ public function alphanumDataProvider(): array
138138
['QazWsx12345', [
139139
__('"%1" length must be equal or less than %2 characters.', 'Test', 10)]
140140
],
141-
[' 12345 ', true],
142141
];
143142
}
144143

app/code/Magento/Sales/Model/Order/Address.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ public function setEmail($email)
601601
*/
602602
public function setTelephone($telephone)
603603
{
604-
return $this->setData(OrderAddressInterface::TELEPHONE, $telephone);
604+
return $this->setData(OrderAddressInterface::TELEPHONE, trim($telephone));
605605
}
606606

607607
/**

dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/AddressRepositoryTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,4 +571,20 @@ private function getWebsite(string $code): WebsiteInterface
571571
$repository = $this->objectManager->get(WebsiteRepositoryInterface::class);
572572
return $repository->get($code);
573573
}
574+
575+
/**
576+
* Test for saving address with extra spaces in phone.
577+
*
578+
* @magentoDataFixture Magento/Customer/_files/customer.php
579+
* @magentoDataFixture Magento/Customer/_files/customer_address.php
580+
*/
581+
public function testSaveNewAddressWithExtraSpacesInPhone()
582+
{
583+
$proposedAddress = $this->_createSecondAddress()
584+
->setCustomerId(1)
585+
->setTelephone(' 123456 ');
586+
$returnedAddress = $this->repository->save($proposedAddress);
587+
$savedAddress = $this->repository->getById($returnedAddress->getId());
588+
$this->assertEquals('123456', $savedAddress->getTelephone());
589+
}
574590
}

0 commit comments

Comments
 (0)