Bugzilla – Attachment 57449 Details for
Bug 17572
Remove issue.t warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17572: Remove itemtype-related warnings from issue.t
Bug-17572-Remove-itemtype-related-warnings-from-is.patch (text/plain), 3.43 KB, created by
Marcel de Rooy
on 2016-11-11 08:29:17 UTC
(
hide
)
Description:
Bug 17572: Remove itemtype-related warnings from issue.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2016-11-11 08:29:17 UTC
Size:
3.43 KB
patch
obsolete
>From c2d3a13710f2102da449d4c0ab14c819fa9f3aa3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 7 Nov 2016 14:55:41 -0300 >Subject: [PATCH] Bug 17572: Remove itemtype-related warnings from issue.t >Content-Type: text/plain; charset=utf-8 > >This patch makes t/db_dependent/Circulation/issue.t create >good sample data for its tests. It does so by creating a random >itemtype. > >To test: >- Run > $ prove t/db_dependent/Circulation/issue.t >=> FAIL: lots of warnings about "item-level_itypes set but no itemtype >set for item" >- Apply the patch >- Run: > $ prove t/db_dependent/Circulation/issue.t >=> SUCCESS: Tests are green, and no warnings. >- Sign off :-D > >Sponsored-by: ByWater Solutions > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Circulation/issue.t | 41 ++++++++++++++++++++++++++------------ > 1 file changed, 28 insertions(+), 13 deletions(-) > >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index a28b1c5..b19fc19 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -17,18 +17,23 @@ > > use Modern::Perl; > >-use Koha::DateUtils; >-use DateTime::Duration; >+use Test::More tests => 32; >+ > use t::lib::Mocks; >+use t::lib::TestBuilder; >+ > use C4::Biblio; >-use C4::Members; > use C4::Circulation; >-use C4::Items; > use C4::Context; >+use C4::Items; >+use C4::Members; > use C4::Reserves; >+use Koha::Database; >+use Koha::DateUtils; > use Koha::Library; > >-use Test::More tests => 32; >+use DateTime::Duration; >+ > > BEGIN { > use_ok('C4::Circulation'); >@@ -50,10 +55,12 @@ can_ok( > ) > ); > >-#Start transaction > my $dbh = C4::Context->dbh; >-$dbh->{RaiseError} = 1; >-$dbh->{AutoCommit} = 0; >+my $schema = Koha::Database->schema; >+#Start transaction >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new(); > > $dbh->do(q|DELETE FROM issues|); > $dbh->do(q|DELETE FROM items|); >@@ -63,7 +70,12 @@ $dbh->do(q|DELETE FROM categories|); > $dbh->do(q|DELETE FROM accountlines|); > $dbh->do(q|DELETE FROM issuingrules|); > >-#Add sample datas >+# Generate sample datas >+my $itemtype = $builder->build( >+ { source => 'Itemtype', >+ value => { notforloan => undef, rentalcharge => 0 } >+ } >+)->{itemtype}; > > #Add Dates > >@@ -158,7 +170,8 @@ my @sampleitem1 = C4::Items::AddItem( > homebranch => $samplebranch1->{branchcode}, > holdingbranch => $samplebranch1->{branchcode}, > issue => 1, >- reserve => 1 >+ reserve => 1, >+ itype => $itemtype > }, > $biblionumber > ); >@@ -170,7 +183,8 @@ my @sampleitem2 = C4::Items::AddItem( > homebranch => $samplebranch2->{branchcode}, > holdingbranch => $samplebranch2->{branchcode}, > notforloan => 1, >- issue => 1 >+ issue => 1, >+ itype => $itemtype > }, > $biblionumber > ); >@@ -369,7 +383,8 @@ my $itemnumber; > itemcallnumber => 'callnumber3', > homebranch => $samplebranch1->{branchcode}, > holdingbranch => $samplebranch1->{branchcode}, >- notforloan => 1, >+ notforloan => 1, >+ itype => $itemtype > }, > $biblionumber > ); >@@ -397,4 +412,4 @@ my $reserve = GetReserve( $reserve_id ); > is( $reserve, undef, 'The reserve should have been correctly cancelled' ); > > #End transaction >-$dbh->rollback; >+$schema->storage->txn_rollback; >-- >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 17572
:
57272
|
57273
|
57275
|
57276
| 57449 |
57450
|
57451