Bugzilla – Attachment 12031 Details for
Bug 8728
t/db_dependent/Reserve.t test doesn't use resdate and expdate arguments for AddReserve
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8728 : Adjust Reserves.t test for resdate and expdate and test setup/teardown
Bug-8728--Adjust-Reservest-test-for-resdate-and-ex.patch (text/plain), 3.54 KB, created by
Chris Cormack
on 2012-09-06 23:00:22 UTC
(
hide
)
Description:
Bug 8728 : Adjust Reserves.t test for resdate and expdate and test setup/teardown
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-09-06 23:00:22 UTC
Size:
3.54 KB
patch
obsolete
>From 3daef8f17f667e59151f897c03395628bc1732bb Mon Sep 17 00:00:00 2001 >From: wajasu <matted-34813@mypacks.net> >Date: Wed, 5 Sep 2012 11:35:42 -0500 >Subject: [PATCH] Bug 8728 : Adjust Reserves.t test for resdate and expdate > and test setup/teardown > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> > >Works better now, creats biblio records, and cleans up after itself as >well. >--- > t/db_dependent/Reserves.t | 58 ++++++++++++++++++++++++++++++++------------- > 1 file changed, 42 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t >index ca4d42e..1e20318 100755 >--- a/t/db_dependent/Reserves.t >+++ b/t/db_dependent/Reserves.t >@@ -5,6 +5,9 @@ use warnings; > use C4::Branch; > > use Test::More tests => 4; >+use MARC::Record; >+use C4::Biblio; >+use C4::Items; > > BEGIN { > use FindBin; >@@ -12,6 +15,20 @@ BEGIN { > use_ok('C4::Reserves'); > } > >+# Setup Test------------------------ >+# Helper biblio. >+diag("\nCreating biblio instance for testing."); >+my ($bibnum, $title, $bibitemnum) = create_helper_biblio(); >+ >+# Helper item for that biblio. >+diag("Creating item instance for testing."); >+my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum); >+ >+# Modify item; setting barcode. >+my $testbarcode = '97531'; >+ModItem({ barcode => $testbarcode }, $bibnum, $itemnumber); >+ >+# Get a borrower > my $dbh = C4::Context->dbh; > my $query = qq/SELECT borrowernumber > FROM borrowers >@@ -20,27 +37,16 @@ my $sth = $dbh->prepare($query); > $sth->execute; > my $borrower = $sth->fetchrow_hashref; > >-$query = qq/SELECT biblionumber, title, itemnumber, barcode >- FROM biblio >- LEFT JOIN items USING (biblionumber) >- WHERE barcode <> "" >- AND barcode IS NOT NULL >- LIMIT 1/; >-$sth = $dbh->prepare($query); >-$sth->execute; >-my $biblio = $sth->fetchrow_hashref; >- >- > my $borrowernumber = $borrower->{'borrowernumber'}; >-my $biblionumber = $biblio->{'biblionumber'}; >-my $itemnumber = $biblio->{'itemnumber'}; >-my $barcode = $biblio->{'barcode'}; >+my $biblionumber = $bibnum; >+my $barcode = $testbarcode; > > my $constraint = 'a'; > my $bibitems = ''; > my $priority = '1'; >+my $resdate = undef; >+my $expdate = undef; > my $notes = ''; >-my $title = $biblio->{'title'}; > my $checkitem = undef; > my $found = undef; > >@@ -48,7 +54,7 @@ my @branches = GetBranchesLoop(); > my $branch = $branches[0][0]{value}; > > AddReserve($branch, $borrowernumber, $biblionumber, >- $constraint, $bibitems, $priority, $notes, >+ $constraint, $bibitems, $priority, $resdate, $expdate, $notes, > $title, $checkitem, $found); > > my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode); >@@ -60,3 +66,23 @@ ok($status eq "Reserved", "CheckReserves Test 2"); > ($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode); > ok($status eq "Reserved", "CheckReserves Test 3"); > >+ >+# Teardown Test--------------------- >+# 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(); >+ my $title = 'Silence in the library'; >+ $bib->append_fields( >+ MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'), >+ MARC::Field->new('245', ' ', ' ', a => $title), >+ ); >+ return ($bibnum, $title, $bibitemnum) = AddBiblio($bib, ''); >+} >-- >1.7.9.5
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 8728
:
11983
| 12031