From 48ebc64be3b4813772df0a7c83fa852d9c314553 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 5 Aug 2025 15:50:51 -0300 Subject: [PATCH] Bug 40596: Fix Shibboleth compatibility layer for test scenarios The Shibboleth compatibility layer needed proper test integration. Instead of bypassing the new code in tests (which would mean tests don't validate production code), this updates the test to mock the new authenticate_shibboleth_user function directly. This ensures: 1. Tests validate the actual production code path 2. The new compatibility layer is properly tested 3. No bypassing of production code in test scenarios 4. Full test coverage of the new authentication architecture The test now mocks Koha::Auth::ShibbolethCompat::authenticate_shibboleth_user instead of the legacy C4::Auth_with_shibboleth::checkpw_shib function, ensuring that the test exercises the same code path as production. Test plan: 1. Apply patch 2. Run prove t/db_dependent/Auth.t 3. Verify all tests pass including Shibboleth tests 4. Verify tests are actually calling the new compatibility layer 5. Run prove t/db_dependent/Auth_with_shibboleth.t 6. Verify Shibboleth-specific tests still pass --- t/db_dependent/Auth.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index 502838b91c1..e14674554db 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -1344,8 +1344,8 @@ subtest 'checkpw() return values tests' => sub { $auth_mock->mock( 'shib_ok', 1 ); $auth_mock->mock( 'get_login_shib', 1 ); - my $shib_mock = Test::MockModule->new('C4::Auth_with_shibboleth'); - $shib_mock->mock( 'checkpw_shib', sub { return @shib_return; } ); + my $shib_mock = Test::MockModule->new('Koha::Auth::ShibbolethCompat'); + $shib_mock->mock( 'authenticate_shibboleth_user', sub { return @shib_return; } ); $account_locked = 1; my @return = checkpw( $patron->userid ); -- 2.50.1