Files
wp-multi-city/tests/FieldGroupTest.php
T
Vladimir Bryzgalov ded71e8fd0 test(wpmc S2): lock ACF-missing guard for FieldGroup
Add patchwork.json to enable function_exists shimming via Patchwork
(required so Brain Monkey can intercept the PHP internal).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-12 17:47:09 +05:00

30 lines
801 B
PHP

<?php
declare(strict_types=1);
namespace WPMultiCity\Tests;
use WPMultiCity\FieldGroup;
final class FieldGroupTest extends TestCase
{
public function test_register_attaches_acf_init_action(): void
{
FieldGroup::register();
self::assertNotFalse(
has_action('acf/init', [FieldGroup::class, 'do_register']),
'FieldGroup::register() must hook acf/init'
);
}
public function test_do_register_is_noop_when_acf_missing(): void
{
\Brain\Monkey\Functions\when('function_exists')->justReturn(false);
\Brain\Monkey\Functions\expect('acf_add_local_field_group')->never();
FieldGroup::do_register();
self::assertTrue(true, 'do_register must not call acf_add_local_field_group when ACF is missing');
}
}