Skip to content
This repository was archived by the owner on Jun 15, 2022. It is now read-only.

Commit 4dd5c51

Browse files
committed
Rename WC_Custom_Order_Table_Install to WooCommerce_Custom_Order_Table_Install
1 parent d388782 commit 4dd5c51

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

includes/class-wc-custom-order-table-install.php renamed to includes/class-woocommerce-custom-orders-table-install.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*
1212
* Usage:
1313
*
14-
* WC_Custom_Order_Table_Install::activate();
14+
* WooCommerce_Custom_Orders_Table_Install::activate();
1515
*/
16-
class WC_Custom_Order_Table_Install {
16+
class WooCommerce_Custom_Orders_Table_Install {
1717

1818
/**
1919
* The option key that contains the current schema version.

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function _manually_load_plugin() {
3535
WC_VERSION
3636
) ) . PHP_EOL;
3737

38-
WC_Custom_Order_Table_Install::activate();
38+
WooCommerce_Custom_Orders_Table_Install::activate();
3939

4040
add_filter( 'woocommerce_email_actions', '__return_empty_array' );
4141
}

tests/test-installation.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,56 +49,56 @@ public function test_can_install_table() {
4949
'The wp_woocommerce_orders table should not exist at the beginning of this test.'
5050
);
5151

52-
WC_Custom_Order_Table_Install::activate();
52+
WooCommerce_Custom_Orders_Table_Install::activate();
5353

5454
$this->assertTrue(
5555
self::orders_table_exists(),
5656
'Upon activation, the table should be created.'
5757
);
5858
$this->assertNotEmpty(
59-
get_option( WC_Custom_Order_Table_Install::SCHEMA_VERSION_KEY ),
59+
get_option( WooCommerce_Custom_Orders_Table_Install::SCHEMA_VERSION_KEY ),
6060
'The schema version should be stored in the options table.'
6161
);
6262
}
6363

6464
public function test_returns_early_if_already_on_latest_schema_version() {
65-
WC_Custom_Order_Table_Install::activate();
65+
WooCommerce_Custom_Orders_Table_Install::activate();
6666

6767
$this->assertFalse(
68-
WC_Custom_Order_Table_Install::activate(),
68+
WooCommerce_Custom_Orders_Table_Install::activate(),
6969
'The activate() method should return false if the schema versions match.'
7070
);
7171
}
7272

7373
public function test_can_upgrade_table() {
74-
WC_Custom_Order_Table_Install::activate();
74+
WooCommerce_Custom_Orders_Table_Install::activate();
7575

7676
// Get the current schema version, then increment it.
77-
$property = new ReflectionProperty( 'WC_Custom_Order_Table_Install', 'table_version' );
77+
$property = new ReflectionProperty( 'WooCommerce_Custom_Orders_Table_Install', 'table_version' );
7878
$property->setAccessible( true );
7979
$version = $property->getValue();
8080
$property->setValue( $version + 1 );
8181

8282
// Run the activation script again.
83-
WC_Custom_Order_Table_Install::activate();
83+
WooCommerce_Custom_Orders_Table_Install::activate();
8484

8585
$this->assertEquals(
8686
$version + 1,
87-
get_option( WC_Custom_Order_Table_Install::SCHEMA_VERSION_KEY ),
87+
get_option( WooCommerce_Custom_Orders_Table_Install::SCHEMA_VERSION_KEY ),
8888
'The schema version should have been incremented.'
8989
);
9090
}
9191

9292
public function test_current_schema_version_is_not_autoloaded() {
9393
global $wpdb;
9494

95-
WC_Custom_Order_Table_Install::activate();
95+
WooCommerce_Custom_Orders_Table_Install::activate();
9696

9797
$this->assertEquals(
9898
'no',
9999
$wpdb->get_var( $wpdb->prepare(
100100
"SELECT autoload FROM $wpdb->options WHERE option_name = %s LIMIT 1",
101-
WC_Custom_Order_Table_Install::SCHEMA_VERSION_KEY
101+
WooCommerce_Custom_Orders_Table_Install::SCHEMA_VERSION_KEY
102102
) ),
103103
'The schema version should not be autoloaded.'
104104
);
@@ -112,7 +112,7 @@ public function test_current_schema_version_is_not_autoloaded() {
112112
public function test_database_indexes( $non_unique, $key_name, $column_name ) {
113113
global $wpdb;
114114

115-
WC_Custom_Order_Table_Install::activate();
115+
WooCommerce_Custom_Orders_Table_Install::activate();
116116

117117
$table = wc_custom_order_table()->get_table_name();
118118
$indexes = $wpdb->get_results( "SHOW INDEX FROM $table", ARRAY_A );

tests/testcase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ protected static function drop_orders_table() {
117117

118118
$wpdb->query( 'DROP TABLE IF EXISTS ' . esc_sql( wc_custom_order_table()->get_table_name() ) );
119119

120-
delete_option( WC_Custom_Order_Table_Install::SCHEMA_VERSION_KEY );
120+
delete_option( WooCommerce_Custom_Orders_Table_Install::SCHEMA_VERSION_KEY );
121121
}
122122

123123
/**

woocommerce-custom-orders-table.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function wc_custom_order_table_autoload( $class ) {
4242
/**
4343
* Install the database tables upon plugin activation.
4444
*/
45-
register_activation_hook( __FILE__, array( 'WC_Custom_Order_Table_Install', 'activate' ) );
45+
register_activation_hook( __FILE__, array( 'WooCommerce_Custom_Orders_Table_Install', 'activate' ) );
4646

4747
/**
4848
* Retrieve an instance of the WC_Custom_Order_Table class.

0 commit comments

Comments
 (0)