Bugzilla – Attachment 111694 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-Up.patch (text/plain), 3.11 KB, created by
Jonathan Druart
on 2020-10-15 10:05:59 UTC
(
hide
)
Description:
Bug 25460: Add unit test for change to C4::OAI::Sets->UpdateOAISetsBiblio()
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-10-15 10:05:59 UTC
Size:
3.11 KB
patch
obsolete
>From a4f1974f4b5b72b82048a4098d0be034bdd43f4d 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 > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >JD amended patch: Put tests inside a subtest, and perltidy >--- > t/db_dependent/OAI/Sets.t | 55 ++++++++++++++++++++++++++++++++++++++- > 1 file changed, 54 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t >index 8db222feb9..1fd577387f 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 => 153; > use Test::MockModule; > use Test::Warn; > use MARC::Record; >@@ -560,6 +560,59 @@ 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'); > >+subtest 'OAI-PMH:AutoUpdateSetsEmbedItemData' => sub { >+ >+ plan tests => 6; >+ >+ 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.20.1
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