Bugzilla – Attachment 148144 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: (follow-up) Make tests less fragile
Bug-33214-follow-up-Make-tests-less-fragile.patch (text/plain), 5.45 KB, created by
Tomás Cohen Arazi (tcohen)
on 2023-03-13 19:53:57 UTC
(
hide
)
Description:
Bug 33214: (follow-up) Make tests less fragile
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2023-03-13 19:53:57 UTC
Size:
5.45 KB
patch
obsolete
>From 12e3e91c134d9900a9712433618ae891197500e6 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 13 Mar 2023 16:53:25 -0300 >Subject: [PATCH] Bug 33214: (follow-up) Make tests less fragile > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../Koha/Filter/ExpandCodedFields.t | 29 +++++++------------ > 1 file changed, 11 insertions(+), 18 deletions(-) > >diff --git a/t/db_dependent/Koha/Filter/ExpandCodedFields.t b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >index 25df74bfbeb..ac33dc9a146 100755 >--- a/t/db_dependent/Koha/Filter/ExpandCodedFields.t >+++ b/t/db_dependent/Koha/Filter/ExpandCodedFields.t >@@ -43,7 +43,6 @@ subtest 'ExpandCodedFields tests' => sub { > my $homebranch = $builder->build_object( { class => 'Koha::Libraries' } ); > my $holdingbranch = $builder->build_object( { class => 'Koha::Libraries' } ); > >- diag("Homebranch: " . $homebranch->branchcode . " : " . $homebranch->branchname); > # Add itemtypes > my $itemtype = $builder->build_object( { class => 'Koha::ItemTypes' } ); > >@@ -51,25 +50,19 @@ subtest 'ExpandCodedFields tests' => sub { > my $biblio = $builder->build_sample_biblio; > my $record = $biblio->metadata->record; > >+ # Add an av >+ my $av = $builder->build_object( { class => 'Koha::AuthorisedValues' } ); >+ > # Suppress the record to test that suppression is never expanded > $record->field('942')->update( n => 1 ); > > # Add an AV ended field to test for AV expansion > $record->append_fields( >- MARC::Field->new( '590', '', '', a => 'CODE' ), >+ MARC::Field->new( '590', '', '', a => $av->authorised_value ), > ); > >- 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 } ); > > my $cache = Koha::Caches->get_instance; > $cache->clear_from_cache("MarcCodedFields-"); >@@ -77,7 +70,7 @@ subtest 'ExpandCodedFields tests' => sub { > $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"); >+ $cache->clear_from_cache("AV_descriptions:" . $av->category); > > C4::Biblio::ModBiblio( $record, $biblio->biblionumber ); > $biblio = Koha::Biblios->find( $biblio->biblionumber); >@@ -94,7 +87,7 @@ subtest 'ExpandCodedFields tests' => sub { > ); > > >- is( $record->field('590')->subfield('a'), 'CODE', 'Record prior to filtering contains AV Code' ); >+ is( $record->field('590')->subfield('a'), $av->authorised_value, 'Record prior to filtering contains AV Code' ); > is( $record->field('942')->subfield('n'), 1, 'Record suppression is numeric prior to filtering' ); > is( $record->field('952')->subfield('a'), $homebranch->branchcode, 'Record prior to filtering contains homebranch branchcode' ); > is( $record->field('952')->subfield('b'), $holdingbranch->branchcode, 'Record prior to filtering contains holdingbranch branchcode' ); >@@ -110,8 +103,8 @@ subtest 'ExpandCodedFields tests' => sub { > > my $result = $processor->process( $record ); > is( ref($result), 'MARC::Record', 'It returns a reference to a MARC::Record object' ); >- is( $result->field('590')->subfield('a'), 'Description should show OPAC', 'Returned record contains AV OPAC description (interface defaults to opac)' ); >- is( $record->field('590')->subfield('a'), 'Description should show OPAC', 'Original record now contains AV OPAC description (interface defaults to opac)' ); >+ is( $result->field('590')->subfield('a'), $av->lib_opac, 'Returned record contains AV OPAC description (interface defaults to opac)' ); >+ is( $record->field('590')->subfield('a'), $av->lib_opac, 'Original record now contains AV OPAC description (interface defaults to opac)' ); > is( $record->field('942')->subfield('n'), 1, 'Record suppression is still numeric after filtering' ); > is( $record->field('952')->subfield('a'), $homebranch->branchname, 'Record now contains homebranch branchname' ); > is( $record->field('952')->subfield('b'), $holdingbranch->branchname, 'Record now contains holdingbranch branchname' ); >@@ -119,12 +112,12 @@ subtest 'ExpandCodedFields tests' => sub { > > # reset record for next test > $record = $biblio->metadata->record; >- is( $record->field('590')->subfield('a'), 'CODE', 'Record reset contains AV Code' ); >+ is( $record->field('590')->subfield('a'), $av->authorised_value, 'Record reset contains AV Code' ); > > # set interface > $processor->options({ interface => 'intranet' }); > $result = $processor->process( $record ); >- is( $record->field('590')->subfield('a'), 'Description should show', 'Original record now contains AV description (interface set to intranet)' ); >+ is( $record->field('590')->subfield('a'), $av->lib, 'Original record now contains AV description (interface set to intranet)' ); > is( $record->field('942')->subfield('n'), 1, 'Item suppression field remains numeric after filtering' ); > > $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