Bugzilla – Attachment 44942 Details for
Bug 15199
t/db_dependent/Review.t should not depend on existing data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 15199: t/db_dependent/Review.t should not depend on existing data
PASSED-QA-Bug-15199-tdbdependentReviewt-should-not.patch (text/plain), 2.20 KB, created by
Katrin Fischer
on 2015-11-18 01:29:34 UTC
(
hide
)
Description:
[PASSED QA] Bug 15199: t/db_dependent/Review.t should not depend on existing data
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-11-18 01:29:34 UTC
Size:
2.20 KB
patch
obsolete
>From 7822c30bc29ce197fd03aef7bb665f2a76158512 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 17 Nov 2015 10:20:39 -0300 >Subject: [PATCH] [PASSED QA] Bug 15199: t/db_dependent/Review.t should not > depend on existing data > >This patch makes the tests create a branch and a patron category instead >of searching for them on the DB. > >To test: >- Apply the patch on current master >- Run > $ prove t/db_dependent/Review.t >=> SUCCESS: Tests pass >- Sign off > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >All test pass successful > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Review.t | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Review.t b/t/db_dependent/Review.t >index 6ef7867..381f5e8 100644 >--- a/t/db_dependent/Review.t >+++ b/t/db_dependent/Review.t >@@ -17,7 +17,11 @@ > # with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+ > use Test::More tests => 117; >+use t::lib::TestBuilder; >+ >+use Koha::Database; > use Time::Piece; > > BEGIN { >@@ -41,16 +45,19 @@ can_ok( > deletereview ) > ); > >-my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+our $dbh = C4::Context->dbh; >+ > $dbh->do('DELETE FROM reviews'); > $dbh->do('DELETE FROM issues'); > $dbh->do('DELETE FROM borrowers'); > >+my $builder = t::lib::TestBuilder->new; >+ > # ---------- Some borrowers for testing ------------------- >-my $categorycode = Koha::Database->new()->schema()->resultset('Category')->first()->categorycode(); >-my $branchcode = Koha::Database->new()->schema()->resultset('Branch')->first()->branchcode(); >+my $categorycode = $builder->build({ source => 'Category' })->{ categorycode }; >+my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; > > my $b1 = Koha::Borrower->new( > { surname => 'Borrower 1', >@@ -383,4 +390,6 @@ ok( !defined($review3), 'Review3 is no longer defined' ); > $numberOfReviews = numberofreviews($status0) + numberofreviews($status1); > is( $numberOfReviews, 0, 'There is no review left in database' ); > >-$dbh->rollback; >+$schema->storage->txn_rollback; >+ >+1; >-- >1.9.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 15199
:
44909
|
44912
| 44942