Bugzilla – Attachment 76659 Details for
Bug 21006
GetMarcBiblio is slow for records with many items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21006: Add unit tests for GetMarcItem
Bug-21006-Add-unit-tests-for-GetMarcItem.patch (text/plain), 2.86 KB, created by
Nick Clemens (kidclamp)
on 2018-07-04 01:27:52 UTC
(
hide
)
Description:
Bug 21006: Add unit tests for GetMarcItem
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-07-04 01:27:52 UTC
Size:
2.86 KB
patch
obsolete
>From 7eb92d1faacfecdfc0e6f6ae5ea1387564688035 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 21006: Add unit tests for GetMarcItem > >To test: >prove -v t/db_dependent/Items.t >--- > t/db_dependent/Items.t | 46 +++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 45 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index ef09873..6fe469e 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -27,11 +27,12 @@ use Koha::Library; > use Koha::DateUtils; > use Koha::MarcSubfieldStructures; > use Koha::Caches; >+use C4::Items; > > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use Test::More tests => 14; >+use Test::More tests => 15; > > use Test::Warn; > >@@ -837,6 +838,49 @@ subtest 'Test logging for ModItem' => 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 ); >+ my ($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; >+ >+}; >+ > # Helper method to set up a Biblio. > sub get_biblio { > my ( $frameworkcode ) = @_; >-- >2.1.4
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 21006
:
76475
|
76490
| 76659 |
76660
|
76661