diff --git a/includes/wpmc-functions.php b/includes/wpmc-functions.php new file mode 100644 index 0000000..b79fbff --- /dev/null +++ b/includes/wpmc-functions.php @@ -0,0 +1,32 @@ +boot(); + // Reset booted flag so this test is order-independent. + $plugin = Plugin::instance(); + $reflection = new \ReflectionClass($plugin); + $prop = $reflection->getProperty('booted'); + $prop->setValue($plugin, false); + + $plugin->boot(); self::assertNotFalse( has_action('init', ['WPMultiCity\\Taxonomy', 'do_register']), @@ -28,6 +34,10 @@ final class PluginBootTest extends TestCase has_action('acf/init', ['WPMultiCity\\FieldGroup', 'do_register']), 'boot() must register FieldGroup on acf/init' ); + self::assertNotFalse( + has_action('init', ['WPMultiCity\\ShortcodeDmr', 'do_register']), + 'boot() must register ShortcodeDmr on init' + ); } public function test_boot_is_idempotent_when_called_multiple_times(): void @@ -55,6 +65,9 @@ final class PluginBootTest extends TestCase \Brain\Monkey\Actions\expectAdded('acf/init') ->with([\WPMultiCity\FieldGroup::class, 'do_register']) ->once(); + \Brain\Monkey\Actions\expectAdded('init') + ->with([\WPMultiCity\ShortcodeDmr::class, 'do_register']) + ->once(); $plugin->boot(); $plugin->boot(); diff --git a/wp-multi-city.php b/wp-multi-city.php index 0ad761b..33c4db1 100644 --- a/wp-multi-city.php +++ b/wp-multi-city.php @@ -21,6 +21,7 @@ defined('WPMC_VERSION') || define('WPMC_VERSION', '0.1.0'); require_once WPMC_PLUGIN_DIR . 'includes/class-plugin.php'; \WPMultiCity\Plugin::register_autoloader(); +require_once WPMC_PLUGIN_DIR . 'includes/wpmc-functions.php'; register_activation_hook(__FILE__, ['\\WPMultiCity\\Activator', 'activate']); register_deactivation_hook(__FILE__, ['\\WPMultiCity\\Activator', 'deactivate']);