Skip to content

Commit 0844fad

Browse files
committed
magento/community-features#259: Customer :: MyAccount :: Reset password for MyAccount
- fix tests to be compatible with PHPUnit 9
1 parent 91571d7 commit 0844fad

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/RequestPasswordResetEmailTest.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ public function testCustomerAccountWithEmailAvailable()
4242

4343
/**
4444
* Check if customer account is not available
45-
*
46-
* @expectedException \Exception
47-
* @expectedExceptionMessage Cannot reset the customer's password
4845
*/
4946
public function testCustomerAccountWithEmailNotAvailable()
5047
{
48+
$this->expectException(\Exception::class);
49+
$this->expectExceptionMessage('Cannot reset the customer\'s password');
5150
$query =
5251
<<<QUERY
5352
mutation {
@@ -59,12 +58,11 @@ public function testCustomerAccountWithEmailNotAvailable()
5958

6059
/**
6160
* Check if email value empty
62-
*
63-
* @expectedException \Exception
64-
* @expectedExceptionMessage You must specify an email address.
6561
*/
6662
public function testEmailAvailableEmptyValue()
6763
{
64+
$this->expectException(\Exception::class);
65+
$this->expectExceptionMessage('You must specify an email address.');
6866
$query = <<<QUERY
6967
mutation {
7068
requestPasswordResetEmail(email: "")
@@ -75,12 +73,11 @@ public function testEmailAvailableEmptyValue()
7573

7674
/**
7775
* Check if email is invalid
78-
*
79-
* @expectedException \Exception
80-
* @expectedExceptionMessage The email address has an invalid format.
8176
*/
8277
public function testEmailAvailableInvalidValue()
8378
{
79+
$this->expectException(\Exception::class);
80+
$this->expectExceptionMessage('The email address has an invalid format.');
8481
$query = <<<QUERY
8582
mutation {
8683
requestPasswordResetEmail(email: "invalid-email")
@@ -93,12 +90,11 @@ public function testEmailAvailableInvalidValue()
9390
* Check if email was sent for lock customer
9491
*
9592
* @magentoApiDataFixture Magento/Customer/_files/customer.php
96-
*
97-
* @expectedException \Exception
98-
* @expectedExceptionMessage The account is locked
9993
*/
10094
public function testRequestPasswordResetEmailForLockCustomer()
10195
{
96+
$this->expectException(\Exception::class);
97+
$this->expectExceptionMessage('The account is locked');
10298
$this->lockCustomer->execute(1);
10399
$query =
104100
<<<QUERY

dev/tests/api-functional/testsuite/Magento/GraphQl/Customer/ResetPasswordTest.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,14 @@ public function testResetCustomerAccountPasswordSuccessfully(): void
8080
/**
8181
* @magentoApiDataFixture Magento/Customer/_files/customer.php
8282
*
83-
* @expectedException \Exception
84-
* @expectedExceptionMessage You must specify an email address.
85-
*
8683
* @throws NoSuchEntityException
8784
* @throws Exception
8885
* @throws LocalizedException
8986
*/
9087
public function testEmailAvailableEmptyValue()
9188
{
89+
$this->expectException(\Exception::class);
90+
$this->expectExceptionMessage('You must specify an email address.');
9291
$query = <<<QUERY
9392
mutation {
9493
resetPassword (
@@ -104,15 +103,14 @@ public function testEmailAvailableEmptyValue()
104103
/**
105104
* @magentoApiDataFixture Magento/Customer/_files/customer.php
106105
*
107-
* @expectedException \Exception
108-
* @expectedExceptionMessage The email address has an invalid format.
109-
*
110106
* @throws NoSuchEntityException
111107
* @throws Exception
112108
* @throws LocalizedException
113109
*/
114110
public function testEmailInvalidValue()
115111
{
112+
$this->expectException(\Exception::class);
113+
$this->expectExceptionMessage('The email address has an invalid format.');
116114
$query = <<<QUERY
117115
mutation {
118116
resetPassword (
@@ -128,15 +126,14 @@ public function testEmailInvalidValue()
128126
/**
129127
* @magentoApiDataFixture Magento/Customer/_files/customer.php
130128
*
131-
* @expectedException \Exception
132-
* @expectedExceptionMessage resetPasswordToken must be specified
133-
*
134129
* @throws NoSuchEntityException
135130
* @throws Exception
136131
* @throws LocalizedException
137132
*/
138133
public function testResetPasswordTokenEmptyValue()
139134
{
135+
$this->expectException(\Exception::class);
136+
$this->expectExceptionMessage('resetPasswordToken must be specified');
140137
$query = <<<QUERY
141138
mutation {
142139
resetPassword (
@@ -152,15 +149,14 @@ public function testResetPasswordTokenEmptyValue()
152149
/**
153150
* @magentoApiDataFixture Magento/Customer/_files/customer.php
154151
*
155-
* @expectedException \Exception
156-
* @expectedExceptionMessage Cannot set the customer's password
157-
*
158152
* @throws NoSuchEntityException
159153
* @throws Exception
160154
* @throws LocalizedException
161155
*/
162156
public function testResetPasswordTokenMismatched()
163157
{
158+
$this->expectException(\Exception::class);
159+
$this->expectExceptionMessage('Cannot set the customer\'s password');
164160
$query = <<<QUERY
165161
mutation {
166162
resetPassword (
@@ -176,15 +172,14 @@ public function testResetPasswordTokenMismatched()
176172
/**
177173
* @magentoApiDataFixture Magento/Customer/_files/customer.php
178174
*
179-
* @expectedException \Exception
180-
* @expectedExceptionMessage newPassword must be specified
181-
*
182175
* @throws NoSuchEntityException
183176
* @throws Exception
184177
* @throws LocalizedException
185178
*/
186179
public function testNewPasswordEmptyValue()
187180
{
181+
$this->expectException(\Exception::class);
182+
$this->expectExceptionMessage('newPassword must be specified');
188183
$query = <<<QUERY
189184
mutation {
190185
resetPassword (
@@ -202,14 +197,13 @@ public function testNewPasswordEmptyValue()
202197
*
203198
* @magentoApiDataFixture Magento/Customer/_files/customer.php
204199
*
205-
* @expectedException \Exception
206-
* @expectedExceptionMessage The account is locked
207-
*
208200
* @throws LocalizedException
209201
* @throws NoSuchEntityException
210202
*/
211203
public function testPasswordResetForLockCustomer()
212204
{
205+
$this->expectException(\Exception::class);
206+
$this->expectExceptionMessage('The account is locked');
213207
$this->lockCustomer->execute(1);
214208
$query = <<<QUERY
215209
mutation {

0 commit comments

Comments
 (0)