Bugzilla – Attachment 148132 Details for
Bug 33214
Make sure cache is cleared properly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33214: Make tests use random data and clear the cache
Bug-33214-Make-tests-use-random-data-and-clear-the.patch (text/plain), 4.25 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-03-13 17:31:54 UTC
(
hide
)
Description:
Bug 33214: Make tests use random data and clear the cache
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-03-13 17:31:54 UTC
Size:
4.25 KB
patch
obsolete
>From e3c850c11ec0a3deff26078d465db71fce84e286 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 13 Mar 2023 14:29:18 -0300 >Subject: [PATCH] Bug 33214: Make tests use random data and clear the cache > >This trivial patch removes some wrongly hardcoded bits, and makes the >tests also clear the cache before and after being run. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Biblio.t | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 188625e1139..af3a424bc9b 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -718,6 +718,8 @@ subtest 'get_marc_notes() MARC21 tests' => sub { > > t::lib::Mocks::mock_preference( 'NotesToHide', '520' ); > >+ my $av = $builder->build_object( { class => 'Koha::AuthorisedValues' } ); >+ > my $biblio = $builder->build_sample_biblio; > my $record = $biblio->metadata->record; > $record->append_fields( >@@ -726,21 +728,12 @@ subtest 'get_marc_notes() MARC21 tests' => sub { > MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), > MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ), > MARC::Field->new( '544', '', '', a => 'Note5' ), >- MARC::Field->new( '590', '', '', a => 'CODE' ), >+ MARC::Field->new( '590', '', '', a => $av->authorised_value ), > MARC::Field->new( '545', '', '', a => 'Invisible on OPAC' ), > ); > >- Koha::AuthorisedValueCategory->new({ category_name => 'TEST' })->store; >- Koha::AuthorisedValue->new( >- { >- category => 'TEST', >- authorised_value => 'CODE', >- lib => 'Description should show', >- lib_opac => 'Description should show OPAC' >- } >- )->store; > my $mss = Koha::MarcSubfieldStructures->find({tagfield => "590", tagsubfield => "a", frameworkcode => $biblio->frameworkcode }); >- $mss->update({ authorised_value => "TEST" }); >+ $mss->update({ authorised_value => $av->category }); > > $mss = Koha::MarcSubfieldStructures->find({tagfield => "545", tagsubfield => "a", frameworkcode => $biblio->frameworkcode }); > $mss->update({ hidden => 1 }); >@@ -749,6 +742,7 @@ subtest 'get_marc_notes() MARC21 tests' => sub { > $cache->clear_from_cache("MarcStructure-0-"); > $cache->clear_from_cache("MarcStructure-1-"); > $cache->clear_from_cache("MarcSubfieldStructure-"); >+ $cache->clear_from_cache("MarcCodedFields-"); > > C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); > $biblio = Koha::Biblios->find( $biblio->biblionumber); >@@ -759,7 +753,7 @@ subtest 'get_marc_notes() MARC21 tests' => sub { > is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); > is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Note shows if not opac (Hidden by Indicator)" ); > is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' ); >- is( $notes->[5]->{marcnote}, 'Description should show', 'Authorised value is correctly parsed to show description rather than code' ); >+ is( $notes->[5]->{marcnote}, $av->lib, 'Authorised value is correctly parsed to show description rather than code' ); > is( $notes->[6]->{marcnote}, 'Invisible on OPAC', 'Note shows if not opac (Hidden by framework)' ); > is( @$notes, 7, 'No more notes' ); > $notes = $biblio->get_marc_notes({ opac => 1 }); >@@ -767,12 +761,13 @@ subtest 'get_marc_notes() MARC21 tests' => sub { > is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); > is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); > is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' ); >- is( $notes->[4]->{marcnote}, 'Description should show OPAC', 'Authorised value is correctly parsed for OPAC to show description rather than code' ); >+ is( $notes->[4]->{marcnote}, $av->lib_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("MarcSubfieldStructure-"); >+ $cache->clear_from_cache("MarcCodedFields-"); > > $schema->storage->txn_rollback; > }; >-- >2.39.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33214
:
148132
|
148134
|
148143
|
148144