From 3da1db1ccc9fc7d0e120afacd1c119d748159ab0 Mon Sep 17 00:00:00 2001 From: Vladimir Bryzgalov Date: Sat, 16 May 2026 20:05:43 +0500 Subject: [PATCH] feat(wpmc S4): Plugin::boot wires OptionsPage + TermMeta + Router + Redirect Co-Authored-By: Claude Sonnet 4.6 --- includes/class-plugin.php | 4 ++++ tests/PluginBootS4Test.php | 42 ++++++++++++++++++++++++++++++++++++++ tests/PluginBootTest.php | 12 +++++++++++ 3 files changed, 58 insertions(+) create mode 100644 tests/PluginBootS4Test.php diff --git a/includes/class-plugin.php b/includes/class-plugin.php index 481a57d..83d3be4 100644 --- a/includes/class-plugin.php +++ b/includes/class-plugin.php @@ -51,6 +51,10 @@ final class Plugin PostType::register(); FieldGroup::register(); ShortcodeDmr::register(); + OptionsPage::register(); + TermMeta::register(); + Redirect::register(); + Router::register(); } private function dependencies_satisfied(): bool diff --git a/tests/PluginBootS4Test.php b/tests/PluginBootS4Test.php new file mode 100644 index 0000000..d3b2847 --- /dev/null +++ b/tests/PluginBootS4Test.php @@ -0,0 +1,42 @@ +getProperty('booted'); + $prop->setValue($plugin, false); + + $plugin->boot(); + + self::assertNotFalse( + has_action('acf/init', ['WPMultiCity\\OptionsPage', 'do_register']), + 'boot() must register OptionsPage on acf/init' + ); + self::assertNotFalse( + has_action('acf/init', ['WPMultiCity\\TermMeta', 'do_register']), + 'boot() must register TermMeta on acf/init' + ); + self::assertSame( + 9999, + has_action('wp', ['WPMultiCity\\Router', 'route']), + 'boot() must register Router on wp@9999' + ); + self::assertSame( + 9998, + has_action('wp', ['WPMultiCity\\Redirect', 'handle']), + 'boot() must register Redirect on wp@9998' + ); + } +} diff --git a/tests/PluginBootTest.php b/tests/PluginBootTest.php index e0c2cf1..acb9e51 100644 --- a/tests/PluginBootTest.php +++ b/tests/PluginBootTest.php @@ -68,6 +68,18 @@ final class PluginBootTest extends TestCase \Brain\Monkey\Actions\expectAdded('init') ->with([\WPMultiCity\ShortcodeDmr::class, 'do_register']) ->once(); + \Brain\Monkey\Actions\expectAdded('acf/init') + ->with([\WPMultiCity\OptionsPage::class, 'do_register']) + ->once(); + \Brain\Monkey\Actions\expectAdded('acf/init') + ->with([\WPMultiCity\TermMeta::class, 'do_register']) + ->once(); + \Brain\Monkey\Actions\expectAdded('wp') + ->with([\WPMultiCity\Redirect::class, 'handle'], 9998) + ->once(); + \Brain\Monkey\Actions\expectAdded('wp') + ->with([\WPMultiCity\Router::class, 'route'], 9999) + ->once(); $plugin->boot(); $plugin->boot();