Bugzilla – Attachment 17390 Details for
Bug 9780
Restrict the right to suppress a record used in some order
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH 2/2] Bug 9780: Add unit test and a new condition in GetOrdersByBiblionumber
0002-new.patch (text/plain), 2.49 KB, created by
Mathieu Saby
on 2013-04-12 13:38:39 UTC
(
hide
)
Description:
[PATCH 2/2] Bug 9780: Add unit test and a new condition in GetOrdersByBiblionumber
Filename:
MIME Type:
Creator:
Mathieu Saby
Created:
2013-04-12 13:38:39 UTC
Size:
2.49 KB
patch
obsolete
>From 18d0ced7f6d97fe1c7854f060ae2faacdcae60df Mon Sep 17 00:00:00 2001 >From: Mathieu Saby <mathieu.saby@univ-rennes2.fr> >Date: Fri, 12 Apr 2013 15:36:25 +0200 >[PATCH 2/2] Bug 9780: Add unit test and a new condition in GetOrdersByBiblionumber > >This followup adds a new condition in GetOrdersByBiblionumber (return unless $biblionumber) >and 4 tests in Acquisition.t > >--- > C4/Acquisition.pm | 1 + > t/db_dependent/Acquisition.t | 19 ++++++++++++++++++- > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index c560b2e..05705ce 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -924,6 +924,7 @@ fields from the aqorders, biblio, and biblioitems tables in the Koha database. > > sub GetOrdersByBiblionumber { > my $biblionumber = shift; >+ return unless $biblionumber; > my $dbh = C4::Context->dbh; > my $query =" > SELECT biblio.*,biblioitems.*, >diff --git a/t/db_dependent/Acquisition.t b/t/db_dependent/Acquisition.t >index c015425..db43118 100755 >--- a/t/db_dependent/Acquisition.t >+++ b/t/db_dependent/Acquisition.t >@@ -10,7 +10,7 @@ use POSIX qw(strftime); > > use C4::Bookseller qw( GetBookSellerFromId ); > >-use Test::More tests => 37; >+use Test::More tests => 42; > > BEGIN { > use_ok('C4::Acquisition'); >@@ -32,6 +32,23 @@ my $grouped = 0; > my $orders = GetPendingOrders( $supplierid, $grouped ); > isa_ok( $orders, 'ARRAY' ); > >+# testing GetOrdersByBiblionumber >+# result should be undef if no params >+my @ordersbybiblionumber = GetOrdersByBiblionumber(); >+is(@ordersbybiblionumber,0,'GetOrdersByBiblionumber : no argument, return undef'); >+# TODO : create 2 orders using the same biblionumber, and check the result of GetOrdersByBiblionumber >+# if a record is used in at least one order, result should be an array with at least one element >+SKIP: { >+ skip 'No Orders, cannot test GetOrdersByBiblionumber', 3 unless( scalar @$orders ); >+ my $testorder = @$orders[0]; >+ my $testbiblio = $testorder->{'biblionumber'}; >+ my @listorders = GetOrdersByBiblionumber($testbiblio); >+ isa_ok( ref @listorders, 'ARRAY','GetOrdersByBiblionumber : result is an array' ); >+ ok( scalar (@listorders) >0,'GetOrdersByBiblionumber : result contains at least one element' ); >+ my @matched_biblios = grep {$_->{biblionumber} == $testbiblio} @listorders; >+ ok ( @matched_biblios == @listorders, "all orders match"); >+} >+ > my @lateorders = GetLateOrders(0); > SKIP: { > skip 'No Late Orders, cannot test AddClaim', 1 unless @lateorders; >-- >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 9780
:
16008
|
16009
|
16161
|
16164
|
16167
|
16233
|
16305
|
16774
|
17390
|
21254
|
22128
|
22168