From ded71e8fd0c6cc7938af364be9f4d2ab3b9ac735 Mon Sep 17 00:00:00 2001 From: Vladimir Bryzgalov Date: Tue, 12 May 2026 17:47:09 +0500 Subject: [PATCH] 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 --- patchwork.json | 3 +++ tests/FieldGroupTest.php | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 patchwork.json diff --git a/patchwork.json b/patchwork.json new file mode 100644 index 0000000..6cf722c --- /dev/null +++ b/patchwork.json @@ -0,0 +1,3 @@ +{ + "redefinable-internals": ["function_exists"] +} diff --git a/tests/FieldGroupTest.php b/tests/FieldGroupTest.php index 06b850d..5f587f6 100644 --- a/tests/FieldGroupTest.php +++ b/tests/FieldGroupTest.php @@ -16,4 +16,14 @@ final class FieldGroupTest extends TestCase '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'); + } }