Bugzilla – Attachment 57510 Details for
Bug 17633
Tests should not call set_preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17633: (QA followup) Remove unneeded warnings
Bug-17633-QA-followup-Remove-unneeded-warnings.patch (text/plain), 4.41 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-11-15 17:09:35 UTC
(
hide
)
Description:
Bug 17633: (QA followup) Remove unneeded warnings
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-11-15 17:09:35 UTC
Size:
4.41 KB
patch
obsolete
>From c386a1b72a3d92d0ecd08a21fe6d178c9ded2b01 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 15 Nov 2016 14:08:15 -0300 >Subject: [PATCH] Bug 17633: (QA followup) Remove unneeded warnings > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Circulation/Returns.t | 15 ++++++++++----- > t/db_dependent/Items.t | 26 ++++++++++++++++++++++++-- > 2 files changed, 34 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t >index 06c44e6..f13dfd2 100644 >--- a/t/db_dependent/Circulation/Returns.t >+++ b/t/db_dependent/Circulation/Returns.t >@@ -19,9 +19,11 @@ use Modern::Perl; > > use Test::More tests => 3; > use Test::MockModule; >-use t::lib::TestBuilder; >+use Test::Warn; > > use t::lib::Mocks; >+use t::lib::TestBuilder; >+ > use C4::Biblio; > use C4::Circulation; > use C4::Items; >@@ -89,7 +91,7 @@ subtest "InProcessingToShelvingCart tests" => sub { > > subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { > >- plan tests => 2; >+ plan tests => 4; > > # Set item-level item types > t::lib::Mocks::mock_preference( "item-level_itypes", 1 ); >@@ -160,9 +162,12 @@ subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub { > > is( $stat->itemtype, $ilevel_itemtype, > "item-level itype recorded on statistics for return"); >- >- AddIssue( $borrower, $item_without_itemtype->{ barcode } ); >- AddReturn( $item_without_itemtype->{ barcode }, $branch ); >+ warning_like { AddIssue( $borrower, $item_without_itemtype->{ barcode } ) } >+ qr/^item-level_itypes set but no itemtype set for item/, >+ 'Item without itemtype set raises warning on AddIssue'; >+ warning_like { AddReturn( $item_without_itemtype->{ barcode }, $branch ) } >+ qr/^item-level_itypes set but no itemtype set for item/, >+ 'Item without itemtype set raises warning on AddReturn'; > #Â Test biblio-level itemtype was recorded on the 'statistics' table > $stat = $schema->resultset('Statistic')->search({ > branch => $branch, >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 19a8a36..ac32f6a 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -418,7 +418,11 @@ subtest 'SearchItems test' => sub { > > my $item3_record = new MARC::Record; > $item3_record->append_fields( >- new MARC::Field($itemfield, '', '', 'z' => 'foobar') >+ new MARC::Field( >+ $itemfield, '', '', >+ 'z' => 'foobar', >+ 'y' => $itemtype->{itemtype} >+ ) > ); > my (undef, undef, $item3_itemnumber) = AddItemFromMarc($item3_record, > $biblionumber); >@@ -652,6 +656,18 @@ subtest 'C4::Items::_build_default_values_for_mod_marc' => sub { > } > }); > >+ my $mss_itemtype = $builder->build({ >+ source => 'MarcSubfieldStructure', >+ value => { >+ frameworkcode => $framework->{frameworkcode}, >+ kohafield => 'items.itype', >+ tagfield => '952', >+ tagsubfield => 'y', >+ } >+ }); >+ >+ my $itemtype = $builder->build({ source => 'Itemtype' })->{itemtype}; >+ > # Create a record with a barcode > my ($biblionumber) = get_biblio( $framework->{frameworkcode} ); > my $item_record = new MARC::Record; >@@ -659,16 +675,22 @@ subtest 'C4::Items::_build_default_values_for_mod_marc' => sub { > my $barcode_field = MARC::Field->new( > '952', ' ', ' ', > p => $a_barcode, >+ y => $itemtype >+ ); >+ my $itemtype_field = MARC::Field->new( >+ '952', ' ', ' ', >+ y => $itemtype > ); > $item_record->append_fields( $barcode_field ); > my (undef, undef, $item_itemnumber) = AddItemFromMarc($item_record, $biblionumber); >- >+ use Data::Printer colored => 1; > # Make sure everything has been set up > my $item = GetItem($item_itemnumber); > is( $item->{barcode}, $a_barcode, 'Everything has been set up correctly, the barcode is defined as expected' ); > > # Delete the barcode field and save the record > $item_record->delete_fields( $barcode_field ); >+ $item_record->append_fields( $itemtype_field ); # itemtype is mandatory > ModItemFromMarc($item_record, $biblionumber, $item_itemnumber); > $item = GetItem($item_itemnumber); > is( $item->{barcode}, undef, 'The default value should have been set to the barcode, the field is mapped to a kohafield' ); >-- >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 17633
:
57507
|
57508
|
57509
| 57510 |
57560