Bugzilla – Attachment 85107 Details for
Bug 20664
Optimize retrieval of biblio and item data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20664: Add unit tests for GetMarcItem
Bug-20664-Add-unit-tests-for-GetMarcItem.patch (text/plain), 2.81 KB, created by
Martin Renvoize (ashimema)
on 2019-02-14 12:53:23 UTC
(
hide
)
Description:
Bug 20664: Add unit tests for GetMarcItem
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-02-14 12:53:23 UTC
Size:
2.81 KB
patch
obsolete
>From 07d4a5e7a5054016c63857d8dc384117d8ea84ac Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 3 Jul 2018 17:05:21 +0000 >Subject: [PATCH] Bug 20664: Add unit tests for GetMarcItem > >To test: >prove -v t/db_dependent/Items.t > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Items.t | 44 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 43 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index abb36dc32e..f60b238dac 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -33,7 +33,7 @@ use Koha::Caches; > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use Test::More tests => 15; >+use Test::More tests => 16; > > use Test::Warn; > >@@ -953,3 +953,45 @@ subtest 'Split subfields in Item2Marc (Bug 21774)' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'tests for GetMarcItem' => sub { >+ plan tests => 1; >+ $schema->storage->txn_begin; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $library = $builder->build({ source => 'Branch', }); >+ my $itemtype = $builder->build({ source => 'Itemtype', }); >+ my $biblio = $builder->build({ >+ source => 'Biblio', >+ value=>{ >+ frameworkcode => "", >+ } >+ }); >+ my $biblioitem = $builder->build({ >+ source => 'Biblioitem', >+ value => { biblionumber => $biblio->{biblionumber} }, >+ }); >+ my $item1 = $builder->build_object({ >+ class => 'Koha::Items', >+ value => { >+ biblionumber => $biblio->{biblionumber}, >+ biblioitemnumber => $biblioitem->{biblioitemnumber}, >+ itype => $itemtype->{itype}, >+ homebranch => $library->{branchcode}, >+ barcode => undef, >+ restricted => 1, >+ itemcallnumber => "", >+ cn_sort => "", >+ } >+ }); >+ my ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); >+ my $get_itemnumber = $item1->itemnumber; >+ my $item1_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $item1->itemnumber ); >+ my (undef, undef, $itemnumber2 ) = AddItemFromMarc( $item1_marc, $biblio->{biblionumber} ); >+ my $item2_marc = C4::Items::GetMarcItem( $biblio->{biblionumber}, $itemnumber2 ); >+ ($itemtag, $item_num_subfield )=C4::Biblio::GetMarcFromKohaField("items.itemnumber"); #get itemnumber tag >+ $item1_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #and remove it >+ $item2_marc->field($itemtag)->delete_subfield(code => $item_num_subfield); #because it won't match >+ is_deeply( $item1_marc, $item2_marc, "The Marc should match if the items are the same"); >+ $schema->storage->txn_rollback; >+}; >-- >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 20664
:
74873
|
75968
|
76045
|
76046
|
76669
|
78868
|
78869
|
78870
|
79225
|
79227
|
79228
|
79229
|
79276
|
79277
|
79278
|
79279
|
84516
|
84517
|
84518
|
84519
|
84520
|
85106
|
85107
|
85108
|
85109
|
85110
|
85776
|
85777
|
85778
|
85779
|
85780
|
85781
|
85898
|
85899
|
85900
|
85901
|
85902
|
85903
|
85904
|
85905
|
86002
|
86003
|
86004
|
86005
|
86006
|
86007
|
86008
|
86009