Bugzilla – Attachment 57592 Details for
Bug 17646
Remove itemtype-related IssueSlip.t warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 17646: Remove itemtype-related IssueSlip.t warnings
PASSED-QA-Bug-17646-Remove-itemtype-related-IssueS.patch (text/plain), 4.01 KB, created by
Martin Renvoize (ashimema)
on 2016-11-17 09:25:33 UTC
(
hide
)
Description:
[PASSED QA] Bug 17646: Remove itemtype-related IssueSlip.t warnings
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2016-11-17 09:25:33 UTC
Size:
4.01 KB
patch
obsolete
>From 09acbe4ea4338f39a4f1c630c6c3dbc227c4b84b Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 16 Nov 2016 10:59:26 -0300 >Subject: [PATCH] [PASSED QA] Bug 17646: Remove itemtype-related IssueSlip.t > warnings > >This patch makes t/db_dependent/Members/IssueSlip.t create >good sample data for its tests. It does so by creating a random >itemtype. > >To test: >- Run > $ prove t/db_dependent/Members/IssueSlip.t >=> FAIL: lots of warnings about "item-level_itypes set but no itemtype >set for item" >- Apply the patch >- Run: > $ prove t/db_dependent/Members/IssueSlip.t >=> SUCCESS: Tests are green, and no warnings. >- Sign off :-D > >Sponsored-by: ByWater Solutions >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >All test pass successfuly > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Members/IssueSlip.t | 42 +++++++++++++++++++++++++++++--------- > 1 file changed, 32 insertions(+), 10 deletions(-) > >diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t >index 98b5ee7..23340fe 100644 >--- a/t/db_dependent/Members/IssueSlip.t >+++ b/t/db_dependent/Members/IssueSlip.t >@@ -1,9 +1,26 @@ > #!/usr/bin/perl > >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+ > use Modern::Perl; > > use Test::More tests => 3; > use Test::MockModule; >+use t::lib::TestBuilder; > > use C4::Biblio; > use C4::Items; >@@ -16,9 +33,9 @@ use DateTime::Duration; > > use MARC::Record; > >+my $schema = Koha::Database->schema; >+$schema->storage->txn_begin; > my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; > > $dbh->do(q|DELETE FROM issues|); > $dbh->do(q|DELETE FROM borrowers|); >@@ -28,18 +45,19 @@ $dbh->do(q|DELETE FROM biblio|); > $dbh->do(q|DELETE FROM categories|); > $dbh->do(q|DELETE FROM letter|); > >-my $branchcode = 'B'; >-Koha::Library->new( { branchcode => $branchcode, branchname => 'Branch' } )->store; >+my $builder = t::lib::TestBuilder->new; > >-my $categorycode = 'C'; >-$dbh->do( "INSERT INTO categories(categorycode) VALUES(?)", >- undef, $categorycode ); >+my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; >+my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; >+my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; > >-my %item_branch_infos = ( >+my %item_infos = ( > homebranch => $branchcode, > holdingbranch => $branchcode, >+ itype => $itemtype > ); > >+ > my $slip_content = <<EOS; > Checked out: > <checkedout> >@@ -84,7 +102,7 @@ $record->append_fields( > ); > my ($biblionumber1) = AddBiblio( $record, '' ); > my $itemnumber1 = >- AddItem( { barcode => $barcode1, %item_branch_infos }, $biblionumber1 ); >+ AddItem( { barcode => $barcode1, %item_infos }, $biblionumber1 ); > > $record = MARC::Record->new; > $record->append_fields( >@@ -95,7 +113,7 @@ $record->append_fields( > ); > my ($biblionumber2) = AddBiblio( $record, '' ); > my $itemnumber2 = >- AddItem( { barcode => $barcode2, %item_branch_infos }, $biblionumber2 ); >+ AddItem( { barcode => $barcode2, %item_infos }, $biblionumber2 ); > > my $borrowernumber = > AddMember( categorycode => $categorycode, branchcode => $branchcode ); >@@ -394,3 +412,7 @@ EOS > $slip = IssueSlip(undef, $borrowernumber+1); > is( $slip->{content}, $empty_slip, 'IssueSlip should not return an empty slip if the borrowernumber passed in param does not exist. But it is what it does for now (FIXME)' ); > }; >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >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 17646
:
57546
|
57553
| 57592