From d8b0d01f1cf7fa0a0d97e8e917811e43c93c867f Mon Sep 17 00:00:00 2001 From: Vladimir Bryzgalov Date: Tue, 12 May 2026 20:11:47 +0500 Subject: [PATCH] feat(wpmc S3): procedural wpmc_* API + smoke test Also fixes PluginBootTest to be order-independent (reset booted flag) and to expect ShortcodeDmr hook that boot() now wires. Co-Authored-By: Claude Sonnet 4.6 --- includes/wpmc-functions.php | 32 ++++++++++++++++++++++++++++++++ tests/HelpersTest.php | 13 +++++++++++++ tests/PluginBootTest.php | 15 ++++++++++++++- wp-multi-city.php | 1 + 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 includes/wpmc-functions.php 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']);