7
7
8
8
namespace Magento \GraphQl \Customer ;
9
9
10
+ use Magento \Customer \Api \AccountManagementInterface ;
11
+ use Magento \Customer \Api \CustomerRepositoryInterface ;
10
12
use Magento \Customer \Model \CustomerAuthUpdate ;
11
13
use Magento \Customer \Model \CustomerRegistry ;
12
14
use Magento \Integration \Api \CustomerTokenServiceInterface ;
@@ -30,13 +32,25 @@ class GetCustomerTest extends GraphQlAbstract
30
32
*/
31
33
private $ customerAuthUpdate ;
32
34
35
+ /**
36
+ * @var AccountManagementInterface
37
+ */
38
+ private $ accountManagement ;
39
+
40
+ /**
41
+ * @var CustomerRepositoryInterface
42
+ */
43
+ private $ customerRepository ;
44
+
33
45
protected function setUp ()
34
46
{
35
47
parent ::setUp ();
36
48
37
49
$ this ->customerTokenService = Bootstrap::getObjectManager ()->get (CustomerTokenServiceInterface::class);
50
+ $ this ->accountManagement = Bootstrap::getObjectManager ()->get (AccountManagementInterface::class);
38
51
$ this ->customerRegistry = Bootstrap::getObjectManager ()->get (CustomerRegistry::class);
39
52
$ this ->customerAuthUpdate = Bootstrap::getObjectManager ()->get (CustomerAuthUpdate::class);
53
+ $ this ->customerRepository = Bootstrap::getObjectManager ()->get (CustomerRepositoryInterface::class);
40
54
}
41
55
42
56
/**
@@ -57,7 +71,12 @@ public function testGetCustomer()
57
71
}
58
72
}
59
73
QUERY ;
60
- $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword ));
74
+ $ response = $ this ->graphQlQuery (
75
+ $ query ,
76
+ [],
77
+ '' ,
78
+ $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword )
79
+ );
61
80
62
81
$ this ->assertEquals (null , $ response ['customer ' ]['id ' ]);
63
82
$ this ->assertEquals ('John ' , $ response ['customer ' ]['firstname ' ]);
@@ -104,7 +123,28 @@ public function testGetCustomerIfAccountIsLocked()
104
123
}
105
124
}
106
125
QUERY ;
107
- $ this ->graphQlQuery ($ query , [], '' , $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword ));
126
+ $ this ->graphQlQuery (
127
+ $ query ,
128
+ [],
129
+ '' ,
130
+ $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword )
131
+ );
132
+ }
133
+
134
+ /**
135
+ * @magentoApiDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php
136
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
137
+ * @expectedException \Exception
138
+ * @expectedExceptionMessage The account sign-in was incorrect or your account is disabled temporarily
139
+ */
140
+ public function testAccountIsNotConfirmed ()
141
+ {
142
+ $ confirmation_required = $ this ->accountManagement ::ACCOUNT_CONFIRMATION_REQUIRED ;
143
+ $ customerEmail =
'[email protected] ' ;
144
+ $ currentPassword = 'password ' ;
145
+ $ customer = $ this ->customerRepository ->getById (1 )->setConfirmation ($ confirmation_required );
146
+ $ this ->customerRepository ->save ($ customer );
147
+ $ this ->getCustomerAuthHeaders ($ customerEmail , $ currentPassword );
108
148
}
109
149
110
150
/**
0 commit comments