Bugzilla – Attachment 111051 Details for
Bug 25460
Allow using item information in OAI set mappings and automatically update sets when items are added, edited or deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25460 : Add unit test for change to C4::OAI::Sets->UpdateOAISetsBiblio()
Bug-25460--Add-unit-test-for-change-to-C4OAISets-U.patch (text/plain), 2.78 KB, created by
Alex Buckley
on 2020-10-01 23:40:51 UTC
(
hide
)
Description:
Bug 25460 : Add unit test for change to C4::OAI::Sets->UpdateOAISetsBiblio()
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2020-10-01 23:40:51 UTC
Size:
2.78 KB
patch
obsolete
>From bc142f88b33decb6070749de2e7d5f9979a4c4da Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Thu, 24 Sep 2020 10:54:17 +0000 >Subject: [PATCH] Bug 25460 : Add unit test for change to > C4::OAI::Sets->UpdateOAISetsBiblio() > >Test plan: > >1. Run unit test: >sudo koha-shell <instancename> >prove t/db_dependent/OAI/Sets.t > >2. All tests should pass > >Sponsored-by: Catalyst IT >--- > t/db_dependent/OAI/Sets.t | 53 ++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 52 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t >index 8db222feb9c..1b8c87b18ac 100755 >--- a/t/db_dependent/OAI/Sets.t >+++ b/t/db_dependent/OAI/Sets.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 152; >+use Test::More tests => 158; > use Test::MockModule; > use Test::Warn; > use MARC::Record; >@@ -560,6 +560,57 @@ is($oai_setsVH->[0]->{id}, $setVH_id, 'id is ok'); > is($oai_setsVH->[0]->{spec}, $setVH->{spec}, 'id is ok'); > is($oai_setsVH->[0]->{name}, $setVH->{name}, 'id is ok'); > >+# Bug 25460 - Embed item data in biblio MARC when OAI-PMH:AutoUpdateSetsEmbedItemData syspref is enabled >+#test >+t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 0 ); >+ >+#Create a set >+my $setFIC = { >+ 'spec' => 'Set where collection code is FIC', >+ 'name' => 'FIC' >+}; >+my $setFIC_id = AddOAISet($setFIC); >+ >+#Create mappings : 'ccode' should be 'FIC' >+my $mappingsFIC; >+$mappingsFIC = [ >+ { >+ marcfield => '952', >+ marcsubfield => '8', >+ operator => 'equal', >+ marcvalue => 'FIC' >+ } >+]; >+ModOAISetMappings($setFIC_id, $mappingsFIC); >+ >+# Create biblio with 'FIC' item >+my $biblio_FIC = $builder->build_sample_biblio(); >+my $item = $builder->build_sample_item( >+ { >+ biblionumber => $biblio_FIC->biblionumber, >+ ccode => 'FIC' >+ } >+); >+ >+#Update >+my $recordFIC = GetMarcBiblio({ biblionumber => $biblio_FIC->biblionumber }); >+UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC); >+ >+#is biblio attached to setFIC ? >+my $oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber); >+is($oai_setsFIC->[0]->{id}, undef, 'id is ok'); >+is($oai_setsFIC->[0]->{spec}, undef, 'id is ok'); >+is($oai_setsFIC->[0]->{name}, undef, 'id is ok'); >+ >+t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSetsEmbedItemData', 1 ); >+UpdateOAISetsBiblio($biblio_FIC->biblionumber, $recordFIC); >+ >+#is biblio attached to setFIC ? >+$oai_setsFIC = GetOAISetsBiblio($biblio_FIC->biblionumber); >+is($oai_setsFIC->[0]->{id}, $setFIC_id, 'id is ok'); >+is($oai_setsFIC->[0]->{spec}, $setFIC->{spec}, 'id is ok'); >+is($oai_setsFIC->[0]->{name}, $setFIC->{name}, 'id is ok'); >+ > > # ---------- Testing CalcOAISetsBiblio ---------- > ok (!defined(CalcOAISetsBiblio), 'CalcOAISetsBiblio without argument is undef'); >-- >2.11.0
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 25460
:
104721
|
104983
|
104985
|
104986
|
104987
|
109560
|
110435
|
110645
|
111051
|
111085
|
111086
|
111644
|
111645
|
111646
|
111647
|
111694
|
111695
|
111715