Bugzilla – Attachment 19905 Details for
Bug 9394
Use reserve_id where possible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9394: (follow-up) modernize test cases
Bug-9394-follow-up-modernize-test-cases.patch (text/plain), 2.68 KB, created by
Chris Cormack
on 2013-07-24 04:50:10 UTC
(
hide
)
Description:
Bug 9394: (follow-up) modernize test cases
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2013-07-24 04:50:10 UTC
Size:
2.68 KB
patch
obsolete
>From e3331bea68542e7fff09b8556f6ab98f9348c242 Mon Sep 17 00:00:00 2001 >From: Galen Charlton <gmc@esilibrary.com> >Date: Tue, 9 Jul 2013 14:13:38 +0000 >Subject: [PATCH] Bug 9394: (follow-up) modernize test cases > >- wrap in a transaction >- create the patron records needed for the test > >To test: > >[1] Run prove -v t/db_dependent/Holds.t >[2] Verify that all tests have passed. >[3] Verify that the additional patron records created > by the test no longer exist in the database. > >Signed-off-by: Galen Charlton <gmc@esilibrary.com> >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > t/db_dependent/Holds.t | 35 ++++++++++++++++------------------- > 1 file changed, 16 insertions(+), 19 deletions(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index c7a95fd..0f70872 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -8,6 +8,7 @@ use Test::More tests => 19; > use MARC::Record; > use C4::Biblio; > use C4::Items; >+use C4::Members; > > BEGIN { > use FindBin; >@@ -15,6 +16,12 @@ BEGIN { > use_ok('C4::Reserves'); > } > >+my $dbh = C4::Context->dbh; >+ >+# Start transaction >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ > my $borrowers_count = 5; > > # Setup Test------------------------ >@@ -26,14 +33,16 @@ my ($bibnum, $title, $bibitemnum) = create_helper_biblio(); > diag("Creating item instance for testing."); > my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); > >-# Get a borrower >-my $dbh = C4::Context->dbh; >-my $query = "SELECT borrowernumber FROM borrowers LIMIT $borrowers_count"; >-my $sth = $dbh->prepare($query); >-$sth->execute; >+# Create some borrowers > my @borrowernumbers; >-while ( my $row = $sth->fetchrow_hashref ) { >- push( @borrowernumbers, $row->{'borrowernumber'} ); >+foreach (1..$borrowers_count) { >+ my $borrowernumber = AddMember( >+ firstname => 'my firstname', >+ surname => 'my surname ' . $_, >+ categorycode => 'S', >+ branchcode => 'CPL', >+ ); >+ push @borrowernumbers, $borrowernumber; > } > > my $biblionumber = $bibnum; >@@ -155,18 +164,6 @@ AlterPriority( 'bottom', $reserve->{'reserve_id'} ); > $reserve = GetReserve( $reserve->{'reserve_id'} ); > ok( $reserve->{'priority'} eq '5', "Test AlterPriority(), move to bottom" ); > >-# Delete the reserves >-diag("Deleting holds."); >-$dbh->do("DELETE FROM reserves WHERE biblionumber = ?", undef, ( $biblionumber ) ); >- >-# Delete item. >-diag("Deleting item testing instance."); >-DelItem($dbh, $bibnum, $itemnumber); >- >-# Delete helper Biblio. >-diag("Deleting biblio testing instance."); >-DelBiblio($bibnum); >- > # Helper method to set up a Biblio. > sub create_helper_biblio { > my $bib = MARC::Record->new(); >-- >1.8.3.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 9394
:
14601
|
14860
|
14863
|
15730
|
15733
|
16676
|
17447
|
18216
|
18318
|
18465
|
18466
|
18492
|
18621
|
19893
|
19894
|
19895
|
19896
|
19897
|
19898
|
19899
|
19902
|
19904
| 19905 |
19906
|
19907
|
19908
|
19909