Bugzilla – Attachment 99313 Details for
Bug 21800
TransformKohaToMarc should respect non-repeatability of item subfields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21800: Add tests for _check_split
Bug-21800-Add-tests-for-checksplit.patch (text/plain), 3.45 KB, created by
Marcel de Rooy
on 2020-02-20 13:29:26 UTC
(
hide
)
Description:
Bug 21800: Add tests for _check_split
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-02-20 13:29:26 UTC
Size:
3.45 KB
patch
obsolete
>From fe1bcfc7c3a7c6fbb46968a1047bd54d53a9aa47 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 20 Feb 2020 08:56:03 +0000 >Subject: [PATCH] Bug 21800: Add tests for _check_split >Content-Type: text/plain; charset=utf-8 > >This new subroutine supports checking the repeatable tag from another >framework. (It will be useful for the item editor.) > >Test plan: >Run t/db_dependent/Biblio/TransformKohaToMarc.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Biblio/TransformKohaToMarc.t | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Biblio/TransformKohaToMarc.t b/t/db_dependent/Biblio/TransformKohaToMarc.t >index f1b203b3bf..fac328d0a5 100644 >--- a/t/db_dependent/Biblio/TransformKohaToMarc.t >+++ b/t/db_dependent/Biblio/TransformKohaToMarc.t >@@ -12,6 +12,7 @@ use C4::Biblio; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >+our $builder = t::lib::TestBuilder->new; > > # Create/overwrite some Koha to MARC mappings in default framework > Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '300', tagsubfield => 'a' })->delete; >@@ -77,14 +78,17 @@ subtest "Working with control fields" => sub { > is( $record->field('001')->data, 'all', 'Verify field 001' ); > }; > >-subtest "Add test for no_split option" => sub { >- plan tests => 4; >+subtest "Add tests for _check_split" => sub { >+ plan tests => 7; > > Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '952', tagsubfield => 'a' })->delete; > Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '952', tagsubfield => 'a', kohafield => 'items.fld1' })->store; > Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '952', tagsubfield => 'b' })->delete; > Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '952', tagsubfield => 'b', kohafield => 'items.fld1' })->store; > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); >+ # add 952a repeatable in another framework >+ my $fw = $builder->build({ source => 'BiblioFramework' })->{frameworkcode}; >+ Koha::MarcSubfieldStructure->new({ frameworkcode => $fw, tagfield => '952', tagsubfield => 'a', repeatable => 1 })->store; > > # Test single value in fld1 > my @cols = ( 'items.fld1' => '01' ); >@@ -92,11 +96,18 @@ subtest "Add test for no_split option" => sub { > is( $record->subfield( '952', 'a' ), '01', 'Check single in 952a' ); > is( $record->subfield( '952', 'b' ), '01', 'Check single in 952b' ); > >- # Test glued (composite) value in fld1 >+ # Test glued (composite) value in fld1 with no_split parameter > @cols = ( 'items.fld1' => '01 | 02' ); > $record = C4::Biblio::TransformKohaToMarc( { @cols }, { no_split => 1 } ); > is( $record->subfield( '952', 'a' ), '01 | 02', 'Check composite in 952a' ); > is( $record->subfield( '952', 'b' ), '01 | 02', 'Check composite in 952b' ); >+ # Test without no_split (subfield is not repeatable) >+ $record = C4::Biblio::TransformKohaToMarc( { @cols } ); >+ is( $record->subfield( '952', 'a' ), '01 | 02', 'Check composite in 952a' ); >+ # Test with other framework (repeatable) >+ $record = C4::Biblio::TransformKohaToMarc( { @cols }, { framework => $fw } ); >+ is( ($record->subfield( '952', 'a' ))[0], '01', "Framework $fw first 952a" ); >+ is( ($record->subfield( '952', 'a' ))[1], '02', "Framework $fw second 952a" ); > }; > > # Cleanup >-- >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 21800
:
98816
|
98817
|
99309
|
99310
|
99311
|
99312
|
99313
|
99517
|
99518
|
99519
|
99520
|
101364
|
101365
|
101366
|
101367
|
101667