7
7
8
8
namespace Magento \GraphQl \Customer ;
9
9
10
+ use Magento \Customer \Api \CustomerRepositoryInterface ;
10
11
use Magento \Customer \Model \CustomerAuthUpdate ;
11
12
use Magento \Customer \Model \CustomerRegistry ;
12
13
use Magento \Integration \Api \CustomerTokenServiceInterface ;
@@ -30,13 +31,19 @@ class GetCustomerTest extends GraphQlAbstract
30
31
*/
31
32
private $ customerAuthUpdate ;
32
33
34
+ /**
35
+ * @var CustomerRepositoryInterface
36
+ */
37
+ private $ customerRepository ;
38
+
33
39
protected function setUp ()
34
40
{
35
41
parent ::setUp ();
36
42
37
43
$ this ->customerTokenService = Bootstrap::getObjectManager ()->get (CustomerTokenServiceInterface::class);
38
44
$ this ->customerRegistry = Bootstrap::getObjectManager ()->get (CustomerRegistry::class);
39
45
$ this ->customerAuthUpdate = Bootstrap::getObjectManager ()->get (CustomerAuthUpdate::class);
46
+ $ this ->customerRepository = Bootstrap::getObjectManager ()->get (CustomerRepositoryInterface::class);
40
47
}
41
48
42
49
/**
@@ -57,7 +64,12 @@ public function testGetCustomer()
57
64
}
58
65
}
59
66
QUERY ;
60
- $ response = $ this ->graphQlQuery ($ query , [], '' , $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword ));
67
+ $ response = $ this ->graphQlQuery (
68
+ $ query ,
69
+ [],
70
+ '' ,
71
+ $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword )
72
+ );
61
73
62
74
$ this ->assertEquals (null , $ response ['customer ' ]['id ' ]);
63
75
$ this ->assertEquals ('John ' , $ response ['customer ' ]['firstname ' ]);
@@ -104,7 +116,39 @@ public function testGetCustomerIfAccountIsLocked()
104
116
}
105
117
}
106
118
QUERY ;
107
- $ this ->graphQlQuery ($ query , [], '' , $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword ));
119
+ $ this ->graphQlQuery (
120
+ $ query ,
121
+ [],
122
+ '' ,
123
+ $ this ->getCustomerAuthHeaders ($ currentEmail , $ currentPassword )
124
+ );
125
+ }
126
+
127
+ /**
128
+ * @magentoApiDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php
129
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
130
+ * @expectedException \Exception
131
+ * @expectedExceptionMessage This account isn't confirmed. Verify and try again.
132
+ */
133
+ public function testAccountIsNotConfirmed ()
134
+ {
135
+ $ customerEmail = 'customer@example.com ' ;
136
+ $ currentPassword = 'password ' ;
137
+ $ headersMap = $ this ->getCustomerAuthHeaders ($ customerEmail , $ currentPassword );
138
+ $ customer = $ this ->customerRepository ->getById (1 )->setConfirmation (
139
+ \Magento \Customer \Api \AccountManagementInterface::ACCOUNT_CONFIRMATION_REQUIRED
140
+ );
141
+ $ this ->customerRepository ->save ($ customer );
142
+ $ query = <<<QUERY
143
+ query {
144
+ customer {
145
+ firstname
146
+ lastname
147
+ email
148
+ }
149
+ }
150
+ QUERY ;
151
+ $ this ->graphQlQuery ($ query , [], '' , $ headersMap );
108
152
}
109
153
110
154
/**
0 commit comments