From 2051e2b61b4b75f1a423cc893726240acc97c694 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Tue, 20 Jun 2023 10:14:23 +0200 Subject: [PATCH] Change 'toggle_cot' class to 'toggle_cot_feature_and_usage' --- .../php/src/Internal/Admin/Orders/EditLockTest.php | 2 +- .../src/Internal/Admin/Orders/PageControllerTest.php | 10 +++++----- .../DataStores/Orders/DataSynchronizerTests.php | 4 ++-- .../DataStores/Orders/OrdersTableQueryTests.php | 4 ++-- .../src/Internal/Utilities/COTMigrationUtilTest.php | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/EditLockTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/EditLockTest.php index dc83d944340..8dea1e4218d 100644 --- a/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/EditLockTest.php +++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/EditLockTest.php @@ -41,7 +41,7 @@ class EditLockTest extends WC_Unit_Test_Case { public function setUp(): void { parent::setUp(); $this->setup_cot(); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); $order = new \WC_Order(); diff --git a/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/PageControllerTest.php b/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/PageControllerTest.php index 45f71d1a192..2b9bccd66fe 100644 --- a/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/PageControllerTest.php +++ b/plugins/woocommerce/tests/php/src/Internal/Admin/Orders/PageControllerTest.php @@ -24,7 +24,7 @@ namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders { public function setUp(): void { parent::setUp(); $this->setup_cot(); - $this->toggle_cot( false ); + $this->toggle_cot_feature_and_usage( false ); $this->user_admin = $this->factory->user->create( array( 'role' => 'administrator' ) ); wp_set_current_user( $this->user_admin ); @@ -58,7 +58,7 @@ namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders { $screen->post_type = 'post'; $this->assertFalse( $controller->is_order_screen() ); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); global $pagenow, $plugin_page; $controller = new PageController(); @@ -89,7 +89,7 @@ namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders { $screen->base = 'post'; $this->assertFalse( $controller->is_order_screen( 'shop_order', 'list' ) ); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); global $pagenow, $plugin_page; $controller = new PageController(); @@ -124,7 +124,7 @@ namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders { $mock_filter_input = false; $this->assertFalse( $controller->is_order_screen( 'shop_order', 'edit' ) ); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); global $pagenow, $plugin_page; $controller = new PageController(); @@ -157,7 +157,7 @@ namespace Automattic\WooCommerce\Tests\Internal\Admin\Orders { $screen->action = ''; $this->assertFalse( $controller->is_order_screen( 'shop_order', 'new' ) ); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); global $pagenow, $plugin_page; $controller = new PageController(); diff --git a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/DataSynchronizerTests.php b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/DataSynchronizerTests.php index f193a632d51..b036ef95a94 100644 --- a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/DataSynchronizerTests.php +++ b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/DataSynchronizerTests.php @@ -32,7 +32,7 @@ class DataSynchronizerTests extends HposTestCase { remove_filter( 'query', array( $this, '_drop_temporary_tables' ) ); OrderHelper::delete_order_custom_tables(); // We need this since non-temporary tables won't drop automatically. OrderHelper::create_order_custom_table_if_not_exist(); - OrderHelper::toggle_cot( false ); + OrderHelper::toggle_cot_feature_and_usage( false ); $this->sut = wc_get_container()->get( DataSynchronizer::class ); $features_controller = wc_get_container()->get( Featurescontroller::class ); $features_controller->change_feature_enable( 'custom_order_tables', true ); @@ -508,7 +508,7 @@ class DataSynchronizerTests extends HposTestCase { * @return void */ public function test_auto_draft_deletion(): void { - OrderHelper::toggle_cot( true ); + OrderHelper::toggle_cot_feature_and_usage( true ); $order1 = new \WC_Order(); $order1->set_status( 'auto-draft' ); diff --git a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php index 4faa27ce521..7a94e4171d9 100644 --- a/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php +++ b/plugins/woocommerce/tests/php/src/Internal/DataStores/Orders/OrdersTableQueryTests.php @@ -24,14 +24,14 @@ class OrdersTableQueryTests extends WC_Unit_Test_Case { parent::setUp(); $this->setup_cot(); $this->cot_state = OrderUtil::custom_orders_table_usage_is_enabled(); - $this->toggle_cot( true ); + $this->toggle_cot_feature_and_usage( true ); } /** * Restore the original COT state. */ public function tearDown(): void { - $this->toggle_cot( $this->cot_state ); + $this->toggle_cot_feature_and_usage( $this->cot_state ); parent::tearDown(); } diff --git a/plugins/woocommerce/tests/php/src/Internal/Utilities/COTMigrationUtilTest.php b/plugins/woocommerce/tests/php/src/Internal/Utilities/COTMigrationUtilTest.php index daa5ef000b5..0cbb4633604 100644 --- a/plugins/woocommerce/tests/php/src/Internal/Utilities/COTMigrationUtilTest.php +++ b/plugins/woocommerce/tests/php/src/Internal/Utilities/COTMigrationUtilTest.php @@ -40,7 +40,7 @@ class COTMigrationUtilTest extends WC_Unit_Test_Case { * @return void */ public function tearDown(): void { - OrderHelper::toggle_cot( $this->prev_cot_state ); + OrderHelper::toggle_cot_feature_and_usage( $this->prev_cot_state ); parent::tearDown(); } @@ -125,7 +125,7 @@ class COTMigrationUtilTest extends WC_Unit_Test_Case { public function test_get_table_for_orders_posts() { global $wpdb; - OrderHelper::toggle_cot( false ); + OrderHelper::toggle_cot_feature_and_usage( false ); $table_name = $this->sut->get_table_for_orders(); $this->assertEquals( $wpdb->posts, $table_name ); @@ -137,7 +137,7 @@ class COTMigrationUtilTest extends WC_Unit_Test_Case { public function test_get_table_for_orders_hpos() { global $wpdb; - OrderHelper::toggle_cot( true ); + OrderHelper::toggle_cot_feature_and_usage( true ); $table_name = $this->sut->get_table_for_orders(); $this->assertEquals( "{$wpdb->prefix}wc_orders", $table_name ); @@ -149,7 +149,7 @@ class COTMigrationUtilTest extends WC_Unit_Test_Case { public function test_get_table_for_order_meta_posts() { global $wpdb; - OrderHelper::toggle_cot( false ); + OrderHelper::toggle_cot_feature_and_usage( false ); $table_name = $this->sut->get_table_for_order_meta(); $this->assertEquals( $wpdb->postmeta, $table_name ); @@ -161,7 +161,7 @@ class COTMigrationUtilTest extends WC_Unit_Test_Case { public function test_get_table_for_order_meta_hpos() { global $wpdb; - OrderHelper::toggle_cot( true ); + OrderHelper::toggle_cot_feature_and_usage( true ); $table_name = $this->sut->get_table_for_order_meta(); $this->assertEquals( "{$wpdb->prefix}wc_orders_meta", $table_name );