Bugzilla – Attachment 56237 Details for
Bug 17430
MarkIssueReturned.t should create its own data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17430: Make MarkIssueReturned.t create its own data
Bug-17430-Make-MarkIssueReturnedt-create-its-own-d.patch (text/plain), 2.33 KB, created by
Jonathan Druart
on 2016-10-12 09:22:59 UTC
(
hide
)
Description:
Bug 17430: Make MarkIssueReturned.t create its own data
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-10-12 09:22:59 UTC
Size:
2.33 KB
patch
obsolete
>From 8a1061e16e44c5f9fd44b7667c5610ae16366ced Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 12 Oct 2016 11:01:54 +0200 >Subject: [PATCH] Bug 17430: Make MarkIssueReturned.t create its own data > >This patch makes MarkIssueReturned.t use t::lib::TestBuilder to create >the data it needs. > >To test: >- On master, have a category with categorycode = C >- Run: > $ prove t/db_dependent/Circulation/MarkIssueReturned.t >=> FAIL: primary key problems make the tests fail >- Apply the patch >- Run: > $ prove t/db_dependent/Circulation/MarkIssueReturned.t >=> SUCCESS: Tests are green! >- Sign off :-D > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Circulation/MarkIssueReturned.t | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Circulation/MarkIssueReturned.t b/t/db_dependent/Circulation/MarkIssueReturned.t >index 4c6f52c..a3428eb 100644 >--- a/t/db_dependent/Circulation/MarkIssueReturned.t >+++ b/t/db_dependent/Circulation/MarkIssueReturned.t >@@ -20,22 +20,24 @@ use Modern::Perl; > use Test::More tests => 2; > use Test::Warn; > >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ > use C4::Circulation; > use C4::Members; > use Koha::Library; >-use t::lib::Mocks; > >+my $schema = Koha::Database->schema; > my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; > >-t::lib::Mocks::mock_preference('AnonymousPatron', ''); >+$schema->storage->txn_begin; > >-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); >+t::lib::Mocks::mock_preference('AnonymousPatron', ''); >+ >+my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; >+my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; > > my %item_branch_infos = ( > homebranch => $branchcode, >@@ -53,3 +55,7 @@ t::lib::Mocks::mock_preference('AnonymousPatron', $anonymous_borrowernumber); > $dbh->{PrintError} = 0; > eval { C4::Circulation::MarkIssueReturned( $borrowernumber, 'itemnumber', 'dropbox_branch', 'returndate', 2 ) }; > unlike ( $@, qr<Fatal error: the patron \(\d+\) .* AnonymousPatron>, ); >+ >+$schema->storage->txn_rollback; >+ >+1; >-- >2.8.1
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 17430
:
56233
| 56237