Skip to content

Commit c220794

Browse files
akaashakaash
authored andcommitted
ACQE-4501
1 parent 0748bdb commit c220794

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

dev/tests/integration/testsuite/Magento/Customer/Model/AccountManagement/ForgotPasswordTest.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Customer\Model\AccountManagement;
99

1010
use Magento\Customer\Api\AccountManagementInterface;
11+
use Magento\Customer\Api\CustomerRepositoryInterface;
1112
use Magento\Customer\Model\AccountManagement;
1213
use Magento\Framework\ObjectManagerInterface;
1314
use Magento\Store\Model\StoreManagerInterface;
@@ -39,6 +40,9 @@ class ForgotPasswordTest extends TestCase
3940
/** @var StoreManagerInterface */
4041
private $storeManager;
4142

43+
/** @var CustomerRepositoryInterface */
44+
private $customerRepository;
45+
4246
/**
4347
* @inheritdoc
4448
*/
@@ -50,6 +54,7 @@ protected function setUp(): void
5054
$this->accountManagement = $this->objectManager->get(AccountManagementInterface::class);
5155
$this->transportBuilder = $this->objectManager->get(TransportBuilderMock::class);
5256
$this->storeManager = $this->objectManager->get(StoreManagerInterface::class);
57+
$this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class);
5358
}
5459

5560
/**
@@ -76,6 +81,7 @@ public function testResetPasswordFlowStorefront(): void
7681
{
7782
// Forgot password section
7883
$email = 'customer@example.com';
84+
$customerId = (int)$this->customerRepository->get($email)->getId();
7985
$result = $this->accountManagement->initiatePasswordReset($email, AccountManagement::EMAIL_RESET);
8086
$message = $this->transportBuilder->getSentMessage();
8187
$messageContent = $message->getBody()->getParts()[0]->getRawContent();
@@ -87,22 +93,20 @@ public function testResetPasswordFlowStorefront(): void
8793
$this->accountManagement->initiatePasswordReset($email, AccountManagement::EMAIL_RESET, $websiteId);
8894

8995
// login with old credentials
90-
$customer = $this->accountManagement->authenticate('customer@example.com', 'password');
91-
9296
$this->assertEquals(
93-
$customer->getId(),
94-
$this->accountManagement->authenticate('customer@example.com', 'password')->getId()
97+
$customerId,
98+
$this->accountManagement->authenticate($email, 'password')->getId()
9599
);
96100

97101
// Change password
98-
$this->accountManagement->changePassword('customer@example.com', 'password', 'new_Password123');
102+
$this->accountManagement->changePassword($email, 'password', 'new_Password123');
99103

100104
// Login with new credentials
101-
$this->accountManagement->authenticate('customer@example.com', 'new_Password123');
105+
$this->accountManagement->authenticate($email, 'new_Password123');
102106

103107
$this->assertEquals(
104-
$customer->getId(),
105-
$this->accountManagement->authenticate('customer@example.com', 'new_Password123')->getId()
108+
$customerId,
109+
$this->accountManagement->authenticate($email, 'new_Password123')->getId()
106110
);
107111
}
108112
}

0 commit comments

Comments
 (0)