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 <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-03-10 16:34:26 +00:00 committed by Tomas Cohen Arazi
parent 4e8d76d6f9
commit b4c9a6cfe2
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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;
};