feat(wpmc S5): Plugin::boot wires TitleFilter + LinkFilter + RestUrlFilter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,6 +55,9 @@ final class Plugin
|
|||||||
TermMeta::register();
|
TermMeta::register();
|
||||||
Redirect::register();
|
Redirect::register();
|
||||||
Router::register();
|
Router::register();
|
||||||
|
TitleFilter::register();
|
||||||
|
LinkFilter::register();
|
||||||
|
RestUrlFilter::register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dependencies_satisfied(): bool
|
private function dependencies_satisfied(): bool
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WPMultiCity\Tests;
|
||||||
|
|
||||||
|
use WPMultiCity\Plugin;
|
||||||
|
|
||||||
|
final class PluginBootS5Test extends TestCase
|
||||||
|
{
|
||||||
|
public function test_boot_wires_s5_filter_registrations(): void
|
||||||
|
{
|
||||||
|
if (!class_exists('ACF', false)) {
|
||||||
|
eval('class ACF {}');
|
||||||
|
}
|
||||||
|
|
||||||
|
$plugin = Plugin::instance();
|
||||||
|
$reflection = new \ReflectionClass($plugin);
|
||||||
|
$prop = $reflection->getProperty('booted');
|
||||||
|
$prop->setValue($plugin, false);
|
||||||
|
|
||||||
|
$plugin->boot();
|
||||||
|
|
||||||
|
self::assertSame(
|
||||||
|
9999,
|
||||||
|
has_filter('the_title', 'do_shortcode'),
|
||||||
|
'boot() must wire TitleFilter (the_title → do_shortcode @9999)'
|
||||||
|
);
|
||||||
|
self::assertSame(
|
||||||
|
9999,
|
||||||
|
has_filter('home_url', ['WPMultiCity\\LinkFilter', 'filter_home_url']),
|
||||||
|
'boot() must wire LinkFilter (home_url @9999)'
|
||||||
|
);
|
||||||
|
self::assertNotFalse(
|
||||||
|
has_filter('rest_url', ['WPMultiCity\\RestUrlFilter', 'preserve_host']),
|
||||||
|
'boot() must wire RestUrlFilter'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user