From b4c9a6cfe23a47cd9a3cb5c6a74c51b36dc15855 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 10 Mar 2023 16:34:26 +0000 Subject: [PATCH] Bug 30920: (follow-up) Manually flush caches in tests We can't rely on our cache flushing in either 'store' or 'delete' triggers as t/lib/TestBuilder::build_object skips the Koha::Object store and uses direct DB inserts in preference. Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Item.t | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index f42f8b03a1..bd56d19623 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -1358,6 +1358,10 @@ subtest 'columns_to_str' => sub { $cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcSubfieldStructure-"); + $cache->clear_from_cache("libraries:name"); + $cache->clear_from_cache("itemtype:description:en"); + $cache->clear_from_cache("cn_sources:description"); + $cache->clear_from_cache("AV_descriptions:LOST"); # Creating subfields 'é', 'è' that are not linked with a kohafield Koha::MarcSubfieldStructures->search( @@ -1436,9 +1440,12 @@ subtest 'columns_to_str' => sub { $cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcSubfieldStructure-"); + $cache->clear_from_cache("libraries:name"); + $cache->clear_from_cache("itemtype:description:en"); + $cache->clear_from_cache("cn_sources:description"); + $cache->clear_from_cache("AV_descriptions:LOST"); $schema->storage->txn_rollback; - }; subtest 'strings_map() tests' => sub { @@ -1453,6 +1460,9 @@ subtest 'strings_map() tests' => sub { $cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcSubfieldStructure-"); + $cache->clear_from_cache("libraries:name"); + $cache->clear_from_cache("itemtype:description:en"); + $cache->clear_from_cache("cn_sources:description"); # Recreating subfields just to be sure tests will be ok # 1 => av (LOST) @@ -1561,7 +1571,7 @@ subtest 'strings_map() tests' => sub { class_split_rule => $class_split_rule->class_split_rule, } } - ); + )->store(); $item->set( { @@ -1633,6 +1643,9 @@ subtest 'strings_map() tests' => sub { $cache->clear_from_cache("MarcStructure-0-"); $cache->clear_from_cache("MarcStructure-1-"); $cache->clear_from_cache("MarcSubfieldStructure-"); + $cache->clear_from_cache("libraries:name"); + $cache->clear_from_cache("itemtype:description:en"); + $cache->clear_from_cache("cn_sources:description"); $schema->storage->txn_rollback; }; -- 2.20.1