1111use Magento \Framework \Api \SearchCriteriaBuilder ;
1212use Magento \Framework \Exception \AuthenticationException ;
1313use Magento \Framework \Registry ;
14+ use Magento \Framework \Stdlib \DateTime ;
15+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
1416use Magento \GraphQl \GetCustomerAuthenticationHeader ;
1517use Magento \Sales \Api \OrderRepositoryInterface ;
1618use Magento \Sales \Model \ResourceModel \Order \Collection ;
@@ -48,6 +50,9 @@ class RetrieveOrdersByOrderNumberTest extends GraphQlAbstract
4850 /** @var ProductRepositoryInterface */
4951 private $ productRepository ;
5052
53+ /** @var TimezoneInterface */
54+ private $ timezone ;
55+
5156 /**
5257 * @var DataFixtureStorage
5358 */
@@ -61,6 +66,7 @@ protected function setUp():void
6166 $ this ->orderRepository = $ objectManager ->get (OrderRepositoryInterface::class);
6267 $ this ->searchCriteriaBuilder = $ objectManager ->get (SearchCriteriaBuilder::class);
6368 $ this ->productRepository = $ objectManager ->get (ProductRepositoryInterface::class);
69+ $ this ->timezone = $ objectManager ->get (TimezoneInterface::class);
6470 $ this ->fixtures = $ objectManager ->get (DataFixtureStorageManager::class)->getStorage ();
6571 }
6672
@@ -500,7 +506,8 @@ public function testGetCustomerDescendingSortedOrders()
500506 $ orderNumberCreatedAtExpected = [];
501507 for ($ i = 1 ; $ i <= 3 ; $ i ++) {
502508 $ orderNumber = $ this ->fixtures ->get ('or ' . $ i )->getIncrementId ();
503- $ orderCreatedAt = $ this ->fixtures ->get ('or ' . $ i )->getCreatedAt ();
509+ $ orderCreatedAt = $ this ->timezone ->date ($ this ->fixtures ->get ('or ' . $ i )->getCreatedAt ())
510+ ->format (DateTime::DATETIME_PHP_FORMAT );
504511 $ orderNumberCreatedAtExpected [$ orderNumber ] = $ orderCreatedAt ;
505512 }
506513
0 commit comments