feat(wpmc S2): Plugin::boot() wires Taxonomy + PostType + FieldGroup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -41,7 +41,9 @@ final class Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
// Stage 2-5 hooks register here. Stage 1 (skeleton) intentionally empty.
|
||||
Taxonomy::register();
|
||||
PostType::register();
|
||||
FieldGroup::register();
|
||||
}
|
||||
|
||||
private function dependencies_satisfied(): bool
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace WPMultiCity\Tests;
|
||||
|
||||
use WPMultiCity\Plugin;
|
||||
|
||||
final class PluginBootTest extends TestCase
|
||||
{
|
||||
public function test_boot_attaches_init_and_acf_init_hooks_when_acf_present(): void
|
||||
{
|
||||
// Simulate ACF being active so boot() proceeds past the dependency guard.
|
||||
if (!class_exists('ACF', false)) {
|
||||
eval('class ACF {}');
|
||||
}
|
||||
|
||||
Plugin::instance()->boot();
|
||||
|
||||
self::assertNotFalse(
|
||||
has_action('init', ['WPMultiCity\\Taxonomy', 'do_register']),
|
||||
'boot() must register Taxonomy on init'
|
||||
);
|
||||
self::assertNotFalse(
|
||||
has_action('init', ['WPMultiCity\\PostType', 'do_register']),
|
||||
'boot() must register PostType on init'
|
||||
);
|
||||
self::assertNotFalse(
|
||||
has_action('acf/init', ['WPMultiCity\\FieldGroup', 'do_register']),
|
||||
'boot() must register FieldGroup on acf/init'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user