From 6a7d4ddfec4ac600ef38e916beb50a536988e77a Mon Sep 17 00:00:00 2001 From: Nikolay Strikhar Date: Mon, 24 Aug 2026 15:13:48 +0200 Subject: [PATCH] Prove the recorder that pins the guard check ahead of the dependency check --- tests/unit/LoaderTest.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/unit/LoaderTest.php b/tests/unit/LoaderTest.php index cc9e049..a6f3677 100644 --- a/tests/unit/LoaderTest.php +++ b/tests/unit/LoaderTest.php @@ -387,21 +387,27 @@ public function test_an_already_loaded_sub_plugin_is_not_dependency_checked(): v $constant = $this->define_guard( 'ABSORBER_LOADED_BEFORE_DEPS_GUARD' ); $checked = 0; - $this->register( - [ - 'dependency_check' => static function () use ( &$checked ) { - ++$checked; - return false; - }, - ], - $constant - ); + $check = static function () use ( &$checked ) { + ++$checked; + + return false; + }; + + $this->register( [ 'dependency_check' => $check ], $constant ); $this->loader()->load_all(); $this->assertSame( 0, $checked ); $this->assertSame( [], $this->queued_notices(), 'No notice for a plugin that is already running.' ); + + // The recorder has to be shown to work. A mistyped config key, a fixture that dropped the + // override, a load path that stopped reading `dependency_check` at all: each leaves this + // counter at zero for a reason that has nothing to do with the gate order, and this is the + // only test pinning the order that carries the whole re-declaration guarantee. + $check(); + + $this->assertSame( 1, $checked, 'The recorder must catch a call that really happened.' ); } public function test_the_should_load_filter_can_veto_the_load(): void {