Change 'toggle_cot' class to 'toggle_cot_feature_and_usage'

This commit is contained in:
Nestor Soriano 2023-06-20 10:14:23 +02:00
parent 2ce0d70f1e
commit 2051e2b61b
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
5 changed files with 15 additions and 15 deletions

View File

@ -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();

View File

@ -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();

View File

@ -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' );

View File

@ -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();
}

View File

@ -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 );