From 818f6f912b7e31e10c5de3e577d68332c178e4bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= Date: Wed, 14 Jan 2026 14:50:08 -0300 Subject: [PATCH] Bug 41616: Silence warning in authority_hooks.t MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch silences a useless warning that is printed when in ES context. To test: 1. Launch a KTD instance with ES enabled: $ ktd --proxy --name 41616 --search-engine es8 up -d $ ktd --name 41616 --wait-ready 120 2. Run: $ ktd --name 41616 --shell k$ prove t/db_dependent/Koha/Plugins/authority_hooks.t => SUCCESS: Tests pass => FAIL: You see: ```shell prove t/db_dependent/Koha/Plugins/authority_hooks.t t/db_dependent/Koha/Plugins/authority_hooks.t ................. 1/5 Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'elasticsearch_to_document ref record: MARC::Record - ref document: HASH' Plugin error (Test Plugin): Exception 'Koha::Exception' thrown 'elasticsearch_to_document ref record: MARC::Record - ref document: HASH' t/db_dependent/Koha/Plugins/authority_hooks.t ................. ok All tests successful. Files=20, Tests=119, 24 wallclock secs ( 0.04 usr 0.02 sys + 17.89 cusr 2.33 csys = 20.28 CPU) Result: PASS ``` 3. Apply this patch 4. Repeat 2 => SUCCESS: No tests changes, but no more weird warnings about elasticsearch 5. Sign off :-D 6. Cleanup: $ ktd --name 41616 down Signed-off-by: Tomás Cohen Arazi --- t/db_dependent/Koha/Plugins/authority_hooks.t | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/db_dependent/Koha/Plugins/authority_hooks.t b/t/db_dependent/Koha/Plugins/authority_hooks.t index 14a69b51e4..1c07a54491 100755 --- a/t/db_dependent/Koha/Plugins/authority_hooks.t +++ b/t/db_dependent/Koha/Plugins/authority_hooks.t @@ -49,6 +49,9 @@ subtest 'after_authority_action hook' => sub { $schema->storage->txn_begin; + my $test_mock = Test::MockModule->new('Koha::Plugin::Test'); + $test_mock->mock( 'elasticsearch_to_document' => undef ); + my $plugins = Koha::Plugins->new; $plugins->InstallPlugins; my $plugin = Koha::Plugin::Test->new->enable; -- 2.50.1 (Apple Git-155)