File tree 2 files changed +23
-27
lines changed
app/code/Magento/WishlistGraphQl/Model/Resolver
dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist
2 files changed +23
-27
lines changed Original file line number Diff line number Diff line change 14
14
use Magento \Framework \GraphQl \Exception \GraphQlAuthorizationException ;
15
15
16
16
/**
17
- * Fetches the Wishlists data according to the GraphQL schema
17
+ * Fetches customer wishlist data
18
18
*/
19
19
class CustomerWishlistResolver implements ResolverInterface
20
20
{
@@ -41,7 +41,6 @@ public function resolve(
41
41
array $ value = null ,
42
42
array $ args = null
43
43
) {
44
- /* Guest checking */
45
44
if (false === $ context ->getExtensionAttributes ()->getIsCustomer ()) {
46
45
throw new GraphQlAuthorizationException (__ ('The current customer isn \'t authorized. ' ));
47
46
}
Original file line number Diff line number Diff line change @@ -44,20 +44,19 @@ public function testCustomerWishlist(): void
44
44
$ query =
45
45
<<<QUERY
46
46
{
47
- customer
48
- {
49
- wishlist {
50
- id
51
- items_count
52
- sharing_code
53
- updated_at
54
- items {
55
- product {
56
- sku
47
+ customer {
48
+ wishlist {
49
+ id
50
+ items_count
51
+ sharing_code
52
+ updated_at
53
+ items {
54
+ product {
55
+ sku
56
+ }
57
+ }
57
58
}
58
- }
59
59
}
60
- }
61
60
}
62
61
QUERY ;
63
62
@@ -82,12 +81,11 @@ public function testCustomerAlwaysHasWishlist(): void
82
81
$ query =
83
82
<<<QUERY
84
83
{
85
- customer
86
- {
87
- wishlist {
88
- id
84
+ customer {
85
+ wishlist {
86
+ id
87
+ }
89
88
}
90
- }
91
89
}
92
90
QUERY ;
93
91
@@ -105,18 +103,17 @@ public function testCustomerAlwaysHasWishlist(): void
105
103
* @expectedException \Exception
106
104
* @expectedExceptionMessage The current customer isn't authorized.
107
105
*/
108
- public function testGetGuestWishlist ()
106
+ public function testGuestCannotGetWishlist ()
109
107
{
110
108
$ query =
111
109
<<<QUERY
112
110
{
113
- customer
114
- {
115
- wishlists {
116
- items_count
117
- sharing_code
118
- updated_at
119
- }
111
+ customer {
112
+ wishlist {
113
+ items_count
114
+ sharing_code
115
+ updated_at
116
+ }
120
117
}
121
118
}
122
119
QUERY ;
You can’t perform that action at this time.
0 commit comments