Skip to content

Commit c556b2f

Browse files
MC-17925: Customer address attribute Phone validation issue
1 parent dbe4f9f commit c556b2f

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

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

Lines changed: 3 additions & 3 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
{
@@ -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

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)