@@ -194,6 +194,68 @@ public function testGetCustomerOrdersStoreScope()
194194 self ::assertArrayHasKey ('date_of_first_order ' , $ response ['customer ' ]['orders ' ]);
195195 }
196196
197+ /**
198+ * Test the date_of_first_order data for customerOrders query without any scope
199+ *
200+ * @throws AuthenticationException
201+ * @throws Exception
202+ */
203+ public function testGetCustomerOrdersWithoutScope ()
204+ {
205+ $ store2 = $ this ->fixtures ->get ('store2 ' );
206+ $ customerEmail = $ this ->fixtures ->get ('customer ' )->getEmail ();
207+ $ generateToken = $ this ->generateCustomerToken ($ customerEmail , 'password ' );
208+ $ tokenResponse = $ this ->graphQlMutationWithResponseHeaders (
209+ $ generateToken ,
210+ [],
211+ '' ,
212+ ['Store ' => $ store2 ->getCode ()]
213+ );
214+ $ token = $ tokenResponse ['body ' ]['generateCustomerToken ' ]['token ' ];
215+ $ customerAuthHeaders = $ this ->getCustomerHeaders ($ token , $ store2 ->getCode ());
216+
217+ $ query = $ this ->getCustomerOrdersQueryWithFilters ();
218+ $ response = $ this ->graphQlQuery ($ query , [], '' , $ customerAuthHeaders );
219+ self ::assertArrayHasKey ('date_of_first_order ' , $ response ['customer ' ]['orders ' ]);
220+ self ::assertNotNull ($ response ['customer ' ]['orders ' ]['date_of_first_order ' ]);
221+ }
222+
223+ /**
224+ * Test the date_of_first_order data for customerOrders query without
225+ * any scope and store header
226+ *
227+ * @throws AuthenticationException
228+ * @throws Exception
229+ */
230+ #[
231+ DataFixture(ProductFixture::class, as: 'product ' ),
232+ DataFixture(CustomerFixture::class, as: 'customer ' ),
233+ DataFixture(CustomerCartFixture::class, ['customer_id ' => '$customer.id$ ' ], as: 'quote ' ),
234+ DataFixture(AddProductToCartFixture::class, [
235+ 'cart_id ' => '$quote.id$ ' , 'product_id ' => '$product.id$ ' , 'qty ' => 1
236+ ]),
237+ DataFixture(SetBillingAddressFixture::class, ['cart_id ' => '$quote.id$ ' ]),
238+ DataFixture(SetShippingAddressFixture::class, ['cart_id ' => '$quote.id$ ' ]),
239+ DataFixture(SetDeliveryMethodFixture::class, ['cart_id ' => '$quote.id$ ' ]),
240+ DataFixture(SetPaymentMethodFixture::class, ['cart_id ' => '$quote.id$ ' ]),
241+ DataFixture(PlaceOrderFixture::class, ['cart_id ' => '$quote.id$ ' ], 'order ' )
242+ ]
243+ public function testGetCustomerOrdersWithoutScopeAndStoreHeader ()
244+ {
245+ $ customerEmail = $ this ->fixtures ->get ('customer ' )->getEmail ();
246+ $ generateToken = $ this ->generateCustomerToken ($ customerEmail , 'password ' );
247+ $ tokenResponse = $ this ->graphQlMutationWithResponseHeaders (
248+ $ generateToken
249+ );
250+ $ token = $ tokenResponse ['body ' ]['generateCustomerToken ' ]['token ' ];
251+ $ customerAuthHeaders = $ this ->getCustomerHeaders ($ token , null );
252+
253+ $ query = $ this ->getCustomerOrdersQueryWithFilters ();
254+ $ response = $ this ->graphQlQuery ($ query , [], '' , $ customerAuthHeaders );
255+ self ::assertArrayHasKey ('date_of_first_order ' , $ response ['customer ' ]['orders ' ]);
256+ self ::assertNotNull ($ response ['customer ' ]['orders ' ]['date_of_first_order ' ]);
257+ }
258+
197259 /**
198260 * Get Customer Orders query
199261 *
0 commit comments