11
11
use Magento \Framework \Api \SearchCriteriaBuilder ;
12
12
use Magento \Framework \Exception \AuthenticationException ;
13
13
use Magento \Framework \Registry ;
14
+ use Magento \Framework \Stdlib \DateTime ;
15
+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
14
16
use Magento \GraphQl \GetCustomerAuthenticationHeader ;
15
17
use Magento \Sales \Api \OrderRepositoryInterface ;
16
18
use Magento \Sales \Model \ResourceModel \Order \Collection ;
@@ -48,6 +50,9 @@ class RetrieveOrdersByOrderNumberTest extends GraphQlAbstract
48
50
/** @var ProductRepositoryInterface */
49
51
private $ productRepository ;
50
52
53
+ /** @var TimezoneInterface */
54
+ private $ timezone ;
55
+
51
56
/**
52
57
* @var DataFixtureStorage
53
58
*/
@@ -61,6 +66,7 @@ protected function setUp():void
61
66
$ this ->orderRepository = $ objectManager ->get (OrderRepositoryInterface::class);
62
67
$ this ->searchCriteriaBuilder = $ objectManager ->get (SearchCriteriaBuilder::class);
63
68
$ this ->productRepository = $ objectManager ->get (ProductRepositoryInterface::class);
69
+ $ this ->timezone = $ objectManager ->get (TimezoneInterface::class);
64
70
$ this ->fixtures = $ objectManager ->get (DataFixtureStorageManager::class)->getStorage ();
65
71
}
66
72
@@ -500,7 +506,8 @@ public function testGetCustomerDescendingSortedOrders()
500
506
$ orderNumberCreatedAtExpected = [];
501
507
for ($ i = 1 ; $ i <= 3 ; $ i ++) {
502
508
$ 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 );
504
511
$ orderNumberCreatedAtExpected [$ orderNumber ] = $ orderCreatedAt ;
505
512
}
506
513
0 commit comments