Bugzilla – Attachment 57986 Details for
Bug 17722
t/db_dependent/PatronLists.t doesn't run inside a transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17722: Make PatronLists.t run inside a transaction
SIGNED-OFF-Bug-17722-Make-PatronListst-run-inside-.patch (text/plain), 2.82 KB, created by
Josef Moravec
on 2016-12-05 19:48:09 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17722: Make PatronLists.t run inside a transaction
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-12-05 19:48:09 UTC
Size:
2.82 KB
patch
obsolete
>From 6dac6a8ec887d8528a0368f86c6694bcfd8915ed Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 5 Dec 2016 11:19:12 -0300 >Subject: [PATCH] [SIGNED-OFF] Bug 17722: Make PatronLists.t run inside a > transaction > >This patch makes t/db_dependent/PatronLists.t run inside a transaction. >It also makes it generate its own data using t::lib::TestBuilder instead >of relying on sample patrons on the DB. > >To test: >- Run: > $ prove t/db_dependent/PatronLists.t >=> SUCCESS: Tests pass >- Apply the patch >- Run: > $ prove t/db_dependent/PatronLists.t >=> SUCCESS: Tests pass >- Sign off :-D > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/PatronLists.t | 43 ++++++++++++++++++++++++++++++++++--------- > 1 file changed, 34 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/PatronLists.t b/t/db_dependent/PatronLists.t >index 7b8fcf2..a5bb41a 100755 >--- a/t/db_dependent/PatronLists.t >+++ b/t/db_dependent/PatronLists.t >@@ -1,21 +1,42 @@ > #!/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 => 9; >+use Test::More tests => 7; >+use t::lib::TestBuilder; > >-BEGIN { >- use_ok('C4::Context'); >- use_ok('Koha::List::Patron'); >-} >+use Koha::Database; >+use Koha::List::Patron >+ qw( AddPatronList AddPatronsToList DelPatronList DelPatronsFromList GetPatronLists ModPatronList ); >+ >+my $schema = Koha::Database->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; > > C4::Context->_new_userenv('DUMMY SESSION'); > C4::Context->set_userenv(0,0,0,'firstname','surname', 'BRANCH1', 'Library 1', 0, ', '); > >-my $dbh = C4::Context->dbh; >-my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10"); >-$sth->execute(); >-my @borrowers = @{ $sth->fetchall_arrayref( {} ) }; >+# Create 10 sample borrowers >+my @borrowers = (); >+foreach (1..10) { >+ push @borrowers, $builder->build({ source => 'Borrower' }); >+} > > my $owner = $borrowers[0]->{borrowernumber}; > >@@ -78,3 +99,7 @@ DelPatronList( { patron_list_id => $list2->patron_list_id(), owner => $owner } ) > @lists = > GetPatronLists( { patron_list_id => $list1->patron_list_id(), owner => $owner } ); > ok( !@lists, 'DelPatronList works' ); >+ >+$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 17722
:
57968
|
57986
|
57997