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

Commit 0da9d4d

Browse files
committed
Add a new test suite for tests surrounding the plugin's bootstrapping.
1 parent 1dd2a0d commit 0da9d4d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

tests/test-bootstrap.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Tests for the plugin bootstrapping.
4+
*
5+
* @package Woocommerce_Order_Tables
6+
* @author Liquid Web
7+
*/
8+
9+
class BootstrapTest extends WP_UnitTestCase {
10+
11+
/**
12+
* Tear down the plugin after each test run.
13+
*
14+
* @before
15+
*/
16+
public function tear_down_plugin() {
17+
global $wc_custom_order_table;
18+
19+
// Destroy the global $wc_custom_order_table instance.
20+
unset( $wc_custom_order_table );
21+
}
22+
23+
public function test_plugin_only_loads_after_woocommerce() {
24+
global $wc_custom_order_table;
25+
26+
$this->assertNull(
27+
$wc_custom_order_table,
28+
'Before bootstrapping, $wc_custom_order_table should be empty.'
29+
);
30+
31+
do_action( 'woocommerce_init' );
32+
33+
$this->assertInstanceOf(
34+
'WC_Custom_Order_Table',
35+
$wc_custom_order_table,
36+
'The plugin should not be bootstrapped until woocommerce_init.'
37+
);
38+
}
39+
}

0 commit comments

Comments
 (0)