From bd2c6118b7955c275827c70444fcd41e7d4823ec Mon Sep 17 00:00:00 2001 From: Vedanshu Jain Date: Mon, 15 Jan 2024 12:36:58 +0530 Subject: [PATCH] Linting fixes. --- .../DataStores/Orders/OrdersTableDataStore.php | 2 +- .../Orders/OrdersTableDataStoreTests.php | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php index a3ddef964814..bc312b983a54 100644 --- a/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php +++ b/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php @@ -987,7 +987,7 @@ public function get_orders( $args = array() ) { /** * Get unpaid orders last updated before the specified date. * - * @param int $date This timestamp is expected in the timezone in WordPress settings legacy reason, even though it's not a good practice. + * @param int $date This timestamp is expected in the timezone in WordPress settings for legacy reason, even though it's not a good practice. * * @return array Array of order IDs. */ diff --git a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableDataStoreTests.php b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableDataStoreTests.php index 3419dd0daff4..542f323813aa 100644 --- a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableDataStoreTests.php +++ b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableDataStoreTests.php @@ -1207,7 +1207,8 @@ public function test_get_order_count(): void { */ public function test_get_unpaid_orders(): void { // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested -- Intentional usage since timezone is changed for this file. - $now_gmt = current_time( 'timestamp', 1 ); + $now_gmt = time(); + // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested -- Testing a legacy code that does expect the offset timestamp. $now_ist = current_time( 'timestamp', 0 ); // IST (Indian standard time) is 5.5 hours ahead of GMT and is set as timezone for this class. // Create a few orders. @@ -3028,7 +3029,6 @@ public function test_timezone_date_query_support() { $order->set_date_created( '2023-09-01T00:30:00' ); // This would be 2023-08-31T18:00:00 UTC given the current timezone. $this->sut->create( $order ); - $query = new OrdersTableQuery( array( 'date_created_gmt' => '2023-09-01' ) ); $this->assertEquals( 0, count( $query->orders ) ); // Should not return anything as the order was created on 2023-08-31 UTC. @@ -3058,9 +3058,12 @@ public function test_data_retained_when_hooked_in_cache_filter() { $this->toggle_cot_authoritative( true ); $this->enable_cot_sync(); - add_action( 'woocommerce_delete_shop_order_transients', function ( $order_id ) { - wc_get_order( $order_id ); - } ); + add_action( + 'woocommerce_delete_shop_order_transients', + function ( $order_id ) { + wc_get_order( $order_id ); + } + ); $order = OrderHelper::create_order(); $this->assertEquals( 1, $order->get_customer_id() ); @@ -3087,7 +3090,7 @@ public function test_order_cache_is_cleared_on_meta_save() { $order = OrderHelper::create_order(); - // set the cache + // set the cache. wc_get_order( $order->get_id() ); $order->add_meta_data( 'test_key', 'test_value' );