Bugzilla – Attachment 62391 Details for
Bug 18460
Remove itemtype-related Serials.t warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18460: Fix undefined itemtype warning in Serials.t
Bug-18460-Fix-undefined-itemtype-warning-in-Serial.patch (text/plain), 3.35 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-04-19 15:20:44 UTC
(
hide
)
Description:
Bug 18460: Fix undefined itemtype warning in Serials.t
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-04-19 15:20:44 UTC
Size:
3.35 KB
patch
obsolete
>From 5586b2b15606ce841affeb10058b3e8192906507 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 19 Apr 2017 12:15:46 -0300 >Subject: [PATCH] Bug 18460: Fix undefined itemtype warning in Serials.t > >This patch makes the test create an itemtype, and use it for the created item so there's no warning. > >To test: >- Run: > $ prove t/db_dependent/Serials.t >=> FAIL: item-level_itypes set but no itemtype set... warning raised >- Apply the patch >- Run: > $ prove t/db_dependent/Serials.t >=> SUCCESS: Tests pass and no warning is raised >- Sign off :-D > >https://bugs.koha-community.org/show_bug.cgi?id=18361 >--- > t/db_dependent/Serials.t | 27 +++++++++++++++++++++++---- > 1 file changed, 23 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t >index dc6edd3..be7f010 100755 >--- a/t/db_dependent/Serials.t >+++ b/t/db_dependent/Serials.t >@@ -17,6 +17,7 @@ use C4::Items; > use Koha::DateUtils; > use Koha::Acquisition::Booksellers; > use t::lib::Mocks; >+use t::lib::TestBuilder; > use Test::More tests => 49; > > BEGIN { >@@ -29,6 +30,8 @@ my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > $dbh->{RaiseError} = 1; > >+my $builder = t::lib::TestBuilder->new(); >+ > # This could/should be used for all untested methods > my @methods = ('updateClaim'); > can_ok('C4::Serials', @methods); >@@ -140,17 +143,33 @@ ok(C4::Serials::GetSerialStatusFromSerialId($serial->{serialid}), 'test getting > isa_ok(C4::Serials::GetSerialInformation($serial->{serialid}), 'HASH', 'test getting Serial Information'); > > subtest 'Values should not be erased on editing' => sub { >+ > plan tests => 1; >+ > ( $biblionumber, $biblioitemnumber ) = get_biblio(); > my ( $icn_tag, $icn_sf ) = GetMarcFromKohaField( 'items.itemcallnumber', '' ); >- my $item_record = new MARC::Record; >+ my ( $it_tag, $it_sf ) = GetMarcFromKohaField( 'items.itype', '' ); >+ >+ my $itemtype = $builder->build( { source => 'Itemtype' } )->{itemtype}; > my $itemcallnumber = 'XXXmy itemcallnumberXXX'; >- $item_record->append_fields( MARC::Field->new( '080', '', '', "a" => "default" ), MARC::Field->new( $icn_tag, '', '', $icn_sf => $itemcallnumber ), ); >+ >+ my $item_record = new MARC::Record; >+ >+ $item_record->append_fields( >+ MARC::Field->new( '080', '', '', "a" => "default" ), >+ MARC::Field->new( >+ $icn_tag, '', '', >+ $icn_sf => $itemcallnumber, >+ $it_sf => $itemtype >+ ) >+ ); > my ( undef, undef, $itemnumber ) = C4::Items::AddItemFromMarc( $item_record, $biblionumber ); >- my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, 1, undef, undef, "publisheddatetext", "notes" ); >+ my $serialid = C4::Serials::NewIssue( "serialseq", $subscriptionid, $biblionumber, >+ 1, undef, undef, "publisheddatetext", "notes" ); > C4::Serials::AddItem2Serial( $serialid, $itemnumber ); > my $serial_info = C4::Serials::GetSerialInformation($serialid); >- my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } @{ $serial_info->{items}[0]->{iteminformation} }; >+ my ($itemcallnumber_info) = grep { $_->{kohafield} eq 'items.itemcallnumber' } >+ @{ $serial_info->{items}[0]->{iteminformation} }; > like( $itemcallnumber_info->{marc_value}, qr|value="$itemcallnumber"| ); > }; > >-- >2.7.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 18460
:
62391
|
62406
|
62411