Rename more instances of "toggle_cot" to "toggle_cot_feature_and_usage"

This commit is contained in:
Nestor Soriano 2023-03-27 10:25:25 +02:00
parent 33ce695cd2
commit 8bf3f31231
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
6 changed files with 19 additions and 19 deletions

View File

@ -152,7 +152,7 @@ class WC_Unit_Tests_Bootstrap {
private function initialize_hpos() {
\Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::delete_order_custom_tables();
\Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::create_order_custom_table_if_not_exist();
\Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::toggle_cot( true );
\Automattic\WooCommerce\RestApi\UnitTests\Helpers\OrderHelper::toggle_cot_feature_and_usage( true );
}
/**

View File

@ -158,7 +158,7 @@ class OrderHelper {
* @param boolean $enabled TRUE to enable COT or FALSE to disable.
* @return void
*/
public static function toggle_cot( bool $enabled ) {
public static function toggle_cot_feature_and_usage( bool $enabled ) {
$features_controller = wc_get_container()->get( Featurescontroller::class );
$features_controller->change_feature_enable( 'custom_order_tables', $enabled );
@ -189,7 +189,7 @@ class OrderHelper {
*/
public static function create_complex_wp_post_order() {
$current_cot_state = OrderUtil::custom_orders_table_usage_is_enabled();
self::toggle_cot( false );
self::toggle_cot_feature_and_usage( false );
update_option( 'woocommerce_prices_include_tax', 'yes' );
update_option( 'woocommerce_calc_taxes', 'yes' );
$uniq_cust_id = wp_generate_password( 10, false );
@ -259,7 +259,7 @@ class OrderHelper {
$order->save();
$order->save_meta_data();
self::toggle_cot( $current_cot_state );
self::toggle_cot_feature_and_usage( $current_cot_state );
return $order->get_id();
}

View File

@ -49,7 +49,7 @@ trait HPOSToggleTrait {
* @return void
*/
private function toggle_cot_feature_and_usage( bool $enabled ): void {
OrderHelper::toggle_cot( $enabled );
OrderHelper::toggle_cot_feature_and_usage( $enabled );
}
/**

View File

@ -23,7 +23,7 @@ class WC_Order_Factory_Test extends WC_Unit_Test_Case {
public function setUp(): void {
parent::setUp();
$this->cot_state = \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled();
OrderHelper::toggle_cot( false );
OrderHelper::toggle_cot_feature_and_usage( false );
}
/**
@ -34,7 +34,7 @@ class WC_Order_Factory_Test extends WC_Unit_Test_Case {
public function tearDown(): void {
parent::tearDown();
wp_cache_flush();
OrderHelper::toggle_cot( $this->cot_state );
OrderHelper::toggle_cot_feature_and_usage( $this->cot_state );
}
/**
@ -81,7 +81,7 @@ class WC_Order_Factory_Test extends WC_Unit_Test_Case {
* @testDox Test that cache does not interfere with order sorting.
*/
public function test_cache_dont_interfere_with_orders() {
OrderHelper::toggle_cot( $this->cot_state );
OrderHelper::toggle_cot_feature_and_usage( $this->cot_state );
$order1 = OrderHelper::create_order();
$order2 = OrderHelper::create_order();
@ -93,7 +93,7 @@ class WC_Order_Factory_Test extends WC_Unit_Test_Case {
$this->assertEquals( 2, count( $orders ) );
$this->assertEquals( $order1->get_id(), $orders[0]->get_id() );
$this->assertEquals( $order2->get_id(), $orders[1]->get_id() );
OrderHelper::toggle_cot( false );
OrderHelper::toggle_cot_feature_and_usage( false );
}
}

View File

@ -23,7 +23,7 @@ class WC_Order_Data_Store_CPT_Test extends WC_Unit_Test_Case {
public function setUp(): void {
parent::setUp();
$this->prev_cot_state = OrderUtil::custom_orders_table_usage_is_enabled();
OrderHelper::toggle_cot( false );
OrderHelper::toggle_cot_feature_and_usage( false );
}
/**
@ -32,7 +32,7 @@ class WC_Order_Data_Store_CPT_Test 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();
}

View File

@ -72,7 +72,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
public function tearDown(): void {
//phpcs:ignore WordPress.DateTime.RestrictedFunctions.timezone_change_date_default_timezone_set -- We need to change the timezone to test the date sync fields.
update_option( 'timezone_string', $this->original_time_zone );
$this->toggle_cot( $this->cot_state );
$this->toggle_cot_feature_and_usage( $this->cot_state );
$this->clean_up_cot_setup();
parent::tearDown();
}
@ -219,7 +219,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
wp_cache_flush();
$order = new WC_Order();
$order->set_id( $post_order->get_id() );
$this->toggle_cot( true );
$this->toggle_cot_feature_and_usage( true );
$this->switch_data_store( $order, $this->sut );
$this->sut->read( $order );
@ -254,7 +254,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
foreach ( $datastore_updates as $prop => $value ) {
$this->assertEquals( $value, $this->sut->{"get_$prop"}( $order ), "Unable to match prop $prop" );
}
$this->toggle_cot( false );
$this->toggle_cot_feature_and_usage( false );
}
/**
@ -1783,7 +1783,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
* Ideally, this should be possible only from getters and setters for objects, but for backward compatibility, earlier ways are also supported.
*/
public function test_internal_ds_getters_and_setters() {
$this->toggle_cot( true );
$this->toggle_cot_feature_and_usage( true );
$props_to_test = array(
'_download_permissions_granted',
'_recorded_sales',
@ -1830,7 +1830,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
$order->save();
}
$this->assert_get_prop_via_ds_object_and_metadata( $props_to_test, $order, false, $ds_getter_setter_names );
$this->toggle_cot( false );
$this->toggle_cot_feature_and_usage( false );
}
/**
@ -1873,7 +1873,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
* @testDox Legacy getters and setters for props migrated from data stores should be set/reset properly.
*/
public function test_legacy_getters_setters() {
$this->toggle_cot( true );
$this->toggle_cot_feature_and_usage( true );
$order_id = OrderHelper::create_complex_data_store_order( $this->sut );
$order = wc_get_order( $order_id );
$this->switch_data_store( $order, $this->sut );
@ -1906,7 +1906,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
$this->assert_props_value_via_data_store( $order, $bool_props, true );
$this->assert_props_value_via_order_object( $order, $bool_props, true );
$this->toggle_cot( false );
$this->toggle_cot_feature_and_usage( false );
}
/**
@ -2019,7 +2019,7 @@ class OrdersTableDataStoreTests extends HposTestCase {
$this->assertTrue( $should_sync_callable->call( $this->sut, $order ) );
$this->sut->read_multiple( $orders );
$this->assertFalse( $should_sync_callable->call( $this->sut, $order ) );
$this->toggle_cot( false );
$this->toggle_cot_feature_and_usage( false );
}
/**