From eb7d259dd0ec52d1c9d9121975d02c232344d35c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 6 May 2024 12:28:45 +0000 Subject: [PATCH] Bug 36793: Unit test This only applies to 'local' preferences. Test plan: Run sysprefs.t with/without second patch. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit b77cb006f1b1145b0251579e4122b7ad0c1bd0c1) Signed-off-by: Fridolin Somers (cherry picked from commit d39200e0d631cf5f008cbd8d185319d847a595f7) Signed-off-by: Lucas Gass --- t/db_dependent/sysprefs.t | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/sysprefs.t b/t/db_dependent/sysprefs.t index f43f8e3d66..f214bc7719 100755 --- a/t/db_dependent/sysprefs.t +++ b/t/db_dependent/sysprefs.t @@ -19,7 +19,7 @@ # along with Koha; if not, see . use Modern::Perl; -use Test::More tests => 8; +use Test::More tests => 9; use C4::Context; use Koha::Database; @@ -53,9 +53,10 @@ C4::Context->set_preference('testpreference', 'abc'); C4::Context->delete_preference('testpreference'); is(C4::Context->preference('testpreference'), undef, 'deleting preferences'); -C4::Context->set_preference('testpreference', 'def'); -# Delete from the database, it should still be in cache -$dbh->do("DELETE FROM systempreferences WHERE variable='testpreference'"); -is(C4::Context->preference('testpreference'), 'def', 'caching preferences'); -C4::Context->clear_syspref_cache(); -is(C4::Context->preference('testpreference'), undef, 'clearing preference cache'); +# Test delete_preference, check cache; we need an example here with MIXED case ! +C4::Context->enable_syspref_cache; +C4::Context->set_preference( 'TestPreference', 'def' ); +is( C4::Context->preference('testpreference'), 'def', 'lower case, got right value' ); +C4::Context->delete_preference('TestPreference'); +is( C4::Context->preference('TestPreference'), undef, 'mixed case, cache is cleared' ); +is( C4::Context->preference('testpreference'), undef, 'lower case, cache is cleared' );