8
8
namespace Magento \GraphQl \Quote \Customer ;
9
9
10
10
use Exception ;
11
+ use Magento \Customer \Model \CustomerAuthUpdate ;
12
+ use Magento \Customer \Model \CustomerRegistry ;
11
13
use Magento \GraphQl \Quote \GetMaskedQuoteIdByReservedOrderId ;
12
14
use Magento \Integration \Api \CustomerTokenServiceInterface ;
13
15
use Magento \TestFramework \Helper \Bootstrap ;
@@ -28,11 +30,23 @@ class GetCartTest extends GraphQlAbstract
28
30
*/
29
31
private $ customerTokenService ;
30
32
33
+ /**
34
+ * @var CustomerAuthUpdate
35
+ */
36
+ private $ customerAuthUpdate ;
37
+
38
+ /**
39
+ * @var CustomerRegistry
40
+ */
41
+ private $ customerRegistry ;
42
+
31
43
protected function setUp ()
32
44
{
33
45
$ objectManager = Bootstrap::getObjectManager ();
34
46
$ this ->getMaskedQuoteIdByReservedOrderId = $ objectManager ->get (GetMaskedQuoteIdByReservedOrderId::class);
35
47
$ this ->customerTokenService = $ objectManager ->get (CustomerTokenServiceInterface::class);
48
+ $ this ->customerRegistry = Bootstrap::getObjectManager ()->get (CustomerRegistry::class);
49
+ $ this ->customerAuthUpdate = Bootstrap::getObjectManager ()->get (CustomerAuthUpdate::class);
36
50
}
37
51
38
52
/**
@@ -208,6 +222,29 @@ public function testGetCartWithNotExistingStore()
208
222
$ this ->graphQlQuery ($ query , [], '' , $ headerMap );
209
223
}
210
224
225
+ /**
226
+ * _security
227
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
228
+ * @magentoApiDataFixture Magento/GraphQl/Catalog/_files/simple_product.php
229
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/customer/create_empty_cart.php
230
+ * @magentoApiDataFixture Magento/GraphQl/Quote/_files/add_simple_product.php
231
+ */
232
+ public function testGetCartForLockedCustomer ()
233
+ {
234
+ /* lock customer */
235
+ $ customerSecure = $ this ->customerRegistry ->retrieveSecureData (1 );
236
+ $ customerSecure ->setLockExpires ('2030-12-31 00:00:00 ' );
237
+ $ this ->customerAuthUpdate ->saveAuth (1 );
238
+
239
+ $ maskedQuoteId = $ this ->getMaskedQuoteIdByReservedOrderId ->execute ('test_quote ' );
240
+ $ query = $ this ->getQuery ($ maskedQuoteId );
241
+
242
+ $ this ->expectExceptionMessage (
243
+ "The account is locked "
244
+ );
245
+ $ this ->graphQlQuery ($ query , [], '' , $ this ->getHeaderMap ());
246
+ }
247
+
211
248
/**
212
249
* @param string $maskedQuoteId
213
250
* @return string
0 commit comments