feat(wpmc S4): OptionsPage scaffold + main_town_slug filter wiring

This commit is contained in:
Vladimir Bryzgalov
2026-05-16 19:39:18 +05:00
parent 11bfaa08a0
commit 79de284f53
2 changed files with 50 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace WPMultiCity;
final class OptionsPage
{
public const PAGE_SLUG = 'wp-multi-city';
public const GROUP_KEY = 'group_wpmc_routing';
public static function register(): void
{
\add_action('acf/init', [self::class, 'do_register']);
\add_filter('wpmc_main_town_slug', [Helpers::class, 'main_town_slug'], 5);
}
public static function do_register(): void
{
// Implementation in Task 8.
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace WPMultiCity\Tests;
use WPMultiCity\OptionsPage;
final class OptionsPageTest extends TestCase
{
public function test_register_attaches_acf_init_action(): void
{
OptionsPage::register();
self::assertNotFalse(
has_action('acf/init', [OptionsPage::class, 'do_register']),
'OptionsPage::register() must hook acf/init'
);
}
public function test_register_attaches_main_town_slug_filter(): void
{
OptionsPage::register();
self::assertNotFalse(
has_filter('wpmc_main_town_slug', ['WPMultiCity\\Helpers', 'main_town_slug']),
'OptionsPage::register() must hook wpmc_main_town_slug filter'
);
}
}