Files
wp-multi-city/tests/acf-stubs.php
T
Vladimir Bryzgalov 11bfaa08a0 test(wpmc S4): restore ACF-missing guard assertions + tighten stub signature
Re-add ->never() to both noop tests so Brain Monkey/Mockery actively asserts
acf_add_local_field_group is never called when ACF is absent.  Order matters:
expect() must precede when('function_exists')->alias() so FunctionStub sees the
real function_exists and skips the eval() path (function already declared in
acf-stubs.php).  Also tighten stub signature to match real ACF ($field_group,
no type hint, no default).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 19:37:30 +05:00

19 lines
607 B
PHP

<?php
declare(strict_types=1);
/**
* Minimal ACF function stubs for the test suite.
*
* This file is required from TestCase::setUp() AFTER Brain\Monkey\setUp() so
* that Patchwork's stream wrapper instruments these functions and can redefine
* them across successive test classes in the same PHP process.
*
* Functions declared via eval() cannot be re-intercepted by Patchwork after
* restoreAll(); functions from a real file loaded through Patchwork's stream
* wrapper can.
*/
if (!function_exists('acf_add_local_field_group')) {
function acf_add_local_field_group($field_group): void {}
}