feat(wpmc S2): PostType::register() attaches init hook
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WPMultiCity;
|
||||||
|
|
||||||
|
final class PostType
|
||||||
|
{
|
||||||
|
public const SLUG = 'shortcode-town';
|
||||||
|
|
||||||
|
public static function register(): void
|
||||||
|
{
|
||||||
|
add_action('init', [self::class, 'do_register']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function do_register(): void
|
||||||
|
{
|
||||||
|
// Implementation filled in Task 9.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WPMultiCity\Tests;
|
||||||
|
|
||||||
|
use WPMultiCity\PostType;
|
||||||
|
|
||||||
|
final class PostTypeTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_register_attaches_init_action(): void
|
||||||
|
{
|
||||||
|
PostType::register();
|
||||||
|
|
||||||
|
self::assertNotFalse(
|
||||||
|
has_action('init', [PostType::class, 'do_register']),
|
||||||
|
'PostType::register() must attach init action with do_register handler'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user