feat(wpmc 1.1.0): Redirect hook moves to template_redirect@1
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ final class Redirect
|
|||||||
{
|
{
|
||||||
public static function register(): void
|
public static function register(): void
|
||||||
{
|
{
|
||||||
\add_action('wp', [self::class, 'handle'], 9998);
|
\add_action('template_redirect', [self::class, 'handle'], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function handle(): void
|
public static function handle(): void
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ final class PluginBootS4Test extends TestCase
|
|||||||
'boot() must register Router on wp@9999'
|
'boot() must register Router on wp@9999'
|
||||||
);
|
);
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
9998,
|
1,
|
||||||
has_action('wp', ['WPMultiCity\\Redirect', 'handle']),
|
has_action('template_redirect', ['WPMultiCity\\Redirect', 'handle']),
|
||||||
'boot() must register Redirect on wp@9998'
|
'boot() must register Redirect on template_redirect@1'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,8 +74,8 @@ final class PluginBootTest extends TestCase
|
|||||||
\Brain\Monkey\Actions\expectAdded('acf/init')
|
\Brain\Monkey\Actions\expectAdded('acf/init')
|
||||||
->with([\WPMultiCity\TermMeta::class, 'do_register'])
|
->with([\WPMultiCity\TermMeta::class, 'do_register'])
|
||||||
->once();
|
->once();
|
||||||
\Brain\Monkey\Actions\expectAdded('wp')
|
\Brain\Monkey\Actions\expectAdded('template_redirect')
|
||||||
->with([\WPMultiCity\Redirect::class, 'handle'], 9998)
|
->with([\WPMultiCity\Redirect::class, 'handle'], 1)
|
||||||
->once();
|
->once();
|
||||||
\Brain\Monkey\Actions\expectAdded('wp')
|
\Brain\Monkey\Actions\expectAdded('wp')
|
||||||
->with([\WPMultiCity\Router::class, 'route'], 9999)
|
->with([\WPMultiCity\Router::class, 'route'], 9999)
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ use WPMultiCity\Redirect;
|
|||||||
|
|
||||||
final class RedirectTest extends TestCase
|
final class RedirectTest extends TestCase
|
||||||
{
|
{
|
||||||
public function test_register_attaches_wp_action_at_priority_9998(): void
|
public function test_register_attaches_template_redirect_at_priority_1(): void
|
||||||
{
|
{
|
||||||
Redirect::register();
|
Redirect::register();
|
||||||
|
|
||||||
self::assertSame(
|
self::assertSame(
|
||||||
9998,
|
1,
|
||||||
has_action('wp', [Redirect::class, 'handle']),
|
has_action('template_redirect', [Redirect::class, 'handle']),
|
||||||
'Redirect::register() must hook wp action at priority 9998'
|
'Redirect::register() must hook template_redirect at priority 1'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user