From 1ecb98a81e7ce59ef1c5588041b5cfedd419c280 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 12 Oct 2021 09:10:58 +0200 Subject: [PATCH] Bug 28734: Clear cache to prevent random failures MSS is modified, we must clear the cache before and after # Failed test 'Authorised value is correctly parsed to show description rather than code' # at t/db_dependent/Koha/Biblio.t line 617. # got: 'CODE' # expected: 'Description should show' # Failed test 'Authorised value is correctly parsed for OPAC to show description rather than code' # at t/db_dependent/Koha/Biblio.t line 624. # got: 'CODE' # expected: 'Description should show OPAC' # Looks like you failed 2 tests of 13 --- t/db_dependent/Koha/Biblio.t | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 893608d9330..f294606f30e 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -21,6 +21,7 @@ use Test::More tests => 16; use C4::Biblio qw( AddBiblio ModBiblio ); use Koha::Database; +use Koha::Caches; use Koha::Acquisition::Orders; use Koha::AuthorisedValueCategories; use Koha::AuthorisedValues; @@ -605,6 +606,12 @@ subtest 'get_marc_notes() MARC21 tests' => sub { my $mss = Koha::MarcSubfieldStructures->find({tagfield => "590", tagsubfield => "a", frameworkcode => $biblio->frameworkcode }); $mss->update({ authorised_value => "TEST" }); + my $cache = Koha::Caches->get_instance; + $cache->clear_from_cache("MarcStructure-0-"); + $cache->clear_from_cache("MarcStructure-1-"); + $cache->clear_from_cache("default_value_for_mod_marc-"); + $cache->clear_from_cache("MarcSubfieldStructure-"); + C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); $biblio = Koha::Biblios->find( $biblio->biblionumber); @@ -624,6 +631,11 @@ subtest 'get_marc_notes() MARC21 tests' => sub { is( $notes->[4]->{marcnote}, 'Description should show OPAC', 'Authorised value is correctly parsed for OPAC to show description rather than code' ); is( @$notes, 5, 'No more notes' ); + $cache->clear_from_cache("MarcStructure-0-"); + $cache->clear_from_cache("MarcStructure-1-"); + $cache->clear_from_cache("default_value_for_mod_marc-"); + $cache->clear_from_cache("MarcSubfieldStructure-"); + $schema->storage->txn_rollback; }; -- 2.25.1