Bugzilla – Attachment 117626 Details for
Bug 27837
Permanent location is reverted to location when location updated and permanent_location mapped to MARC field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27837: Add unit tests
Bug-27837-Add-unit-tests.patch (text/plain), 2.89 KB, created by
Andrew Fuerste-Henry
on 2021-03-03 21:01:09 UTC
(
hide
)
Description:
Bug 27837: Add unit tests
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2021-03-03 21:01:09 UTC
Size:
2.89 KB
patch
obsolete
>From 941d60c8645423ecf3e035b8adb90c8400ac6da1 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 3 Mar 2021 08:54:39 -0500 >Subject: [PATCH] Bug 27837: Add unit tests > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > t/db_dependent/Items.t | 43 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index a6a45bf925..4ab2e2dac6 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -981,7 +981,7 @@ subtest 'Split subfields in Item2Marc (Bug 21774)' => sub { > }; > > subtest 'ModItemFromMarc' => sub { >- plan tests => 5; >+ plan tests => 6; > $schema->storage->txn_begin; > > my $builder = t::lib::TestBuilder->new; >@@ -1037,5 +1037,46 @@ subtest 'ModItemFromMarc' => sub { > is( $item->get_from_storage->cn_sort, 'YYY', 'cn_sort has been updated' ); > }; > >+ subtest 'permanent_location' => sub { >+ plan tests => 6; >+ >+ my $item = $builder->build_sample_item; >+ >+ # By default, setting location to something new should set permanent location to the same thing >+ # with the usual exceptions >+ $item->set({ location => 'A', permanent_location => 'A' })->store; >+ is( $item->location, 'A', 'initial location set as expected' ); >+ is( $item->permanent_location, 'A', 'initial permanent location set as expected' ); >+ >+ $item->location('B'); >+ my $marc = C4::Items::Item2Marc( $item->unblessed, $item->biblionumber ); >+ ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber ); >+ >+ $item = $item->get_from_storage; >+ is( $item->location, 'B', 'new location set as expected' ); >+ is( $item->permanent_location, 'B', 'new permanent location set as expected' ); >+ >+ # Added a marc mapping for permanent location, allows it to be edited independently >+ my $mapping = Koha::MarcSubfieldStructure->new( >+ { >+ frameworkcode => q{}, >+ tagfield => '952', >+ tagsubfield => 'C', >+ kohafield => 'items.permanent_location', >+ repeatable => 0 >+ } >+ )->store; >+ Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); >+ >+ # Now if we change location, and also pass in a permanent location >+ # the permanent_location will not be overwritten by location >+ $item->location('C'); >+ $marc = C4::Items::Item2Marc( $item->unblessed, $item->biblionumber ); >+ ModItemFromMarc( $marc, $item->biblionumber, $item->itemnumber ); >+ $item = $item->get_from_storage; >+ is( $item->location, 'C', 'next new location set as expected' ); >+ is( $item->permanent_location, 'B', 'permanent location remains unchanged as expected' ); >+ }; >+ > $schema->storage->txn_rollback; > }; >-- >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 27837
:
117570
|
117572
|
117625
|
117626
|
117627
|
117628
|
117634
|
117728
|
117729
|
117730
|
117735
|
117738
|
120361
|
120362
|
120363
|
120364
|
120562
|
120563
|
120564
|
120565
|
120566
|
120616
|
120628
|
120629
|
120832
|
121044
|
121045
|
121046
|
121047
|
121048
|
121049
|
121050
|
121051
|
121052