Bugzilla – Attachment 17053 Details for
Bug 9937
Routines introduced for creating a subscription from an order need unit tests.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 9937: Add new unit tests for new routines (introduced by bug 5343)
PASSED-QA-Bug-9937-Add-new-unit-tests-for-new-rout.patch (text/plain), 5.07 KB, created by
Katrin Fischer
on 2013-03-30 20:20:03 UTC
(
hide
)
Description:
[PASSED QA] Bug 9937: Add new unit tests for new routines (introduced by bug 5343)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-03-30 20:20:03 UTC
Size:
5.07 KB
patch
obsolete
>From aad7cf02ec053f4d6b6b954da010efefa6e6653b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Wed, 27 Mar 2013 15:14:26 +0100 >Subject: [PATCH] [PASSED QA] Bug 9937: Add new unit tests for new routines > (introduced by bug 5343) > >New unit tests for 4 routines: >- C4::Serials::subscriptionCurrentlyOnOrder >- C4::Acquisition::GetLastOrderNotReceivedFromSubscriptionid >- C4::Acquisition::GetLastOrderReceivedFromSubscriptionid >- C4::Budgets::GetBudgetName > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Fixed a tab in t/db/dependent/Budgets.t >All tests, new db_dependent tests and QA script pass. Thx Jonathan! >--- > t/db_dependent/Acquisition/OrderFromSubscription.t | 79 ++++++++++++++++++++ > t/db_dependent/Budgets.t | 9 ++- > 2 files changed, 84 insertions(+), 4 deletions(-) > create mode 100644 t/db_dependent/Acquisition/OrderFromSubscription.t > >diff --git a/t/db_dependent/Acquisition/OrderFromSubscription.t b/t/db_dependent/Acquisition/OrderFromSubscription.t >new file mode 100644 >index 0000000..91936a8 >--- /dev/null >+++ b/t/db_dependent/Acquisition/OrderFromSubscription.t >@@ -0,0 +1,79 @@ >+use Modern::Perl; >+ >+use Test::More tests => 10; >+use Data::Dumper; >+ >+use_ok('C4::Serials'); >+use_ok('C4::Budgets'); >+use_ok('C4::Acquisition'); >+my $supplierlist=eval{GetSuppliersWithLateIssues()}; >+ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues"); >+ >+my $biblionumber = 1; >+my $budgetid; >+my $bpid = AddBudgetPeriod({ >+ budget_period_startdate => '01-01-2015', >+ budget_period_enddate => '31-12-2015', >+ budget_description => "budget desc" >+}); >+ >+my $budget_id = AddBudget({ >+ budget_code => "ABCD", >+ budget_amount => "123.132", >+ budget_name => "Périodiques", >+ budget_notes => "This is a note", >+ budget_description => "Serials", >+ budget_active => 1, >+ budget_period_id => $bpid >+}); >+ >+my $subscriptionid = NewSubscription( >+ undef, "", undef, undef, $budget_id, $biblionumber, '01-01-2013',undef, >+ undef, undef, undef, undef, undef, undef, undef, undef, >+ undef, undef, undef, undef, undef, undef, undef, undef, >+ undef, undef, undef, undef, undef, undef, undef, 1, >+ "notes", undef, undef, undef, undef, undef, undef, 0, >+ "intnotes", 0, undef, undef, 0, undef, '31-12-2013', >+); >+die unless $subscriptionid; >+my $cost = 42.00; >+my $subscription = GetSubscription( $subscriptionid ); >+my ( $basketno, $ordernumber ) = NewOrder({ >+ biblionumber => $subscription->{biblionumber}, >+ entrydate => '01-01-2013', >+ quantity => 1, >+ currency => 'USD', >+ listprice => $cost, >+ notes => "This is a note", >+ basketno => 1, >+ rrp => $cost, >+ ecost => $cost, >+ gstrate => 0.0500, >+ orderstatus => 0, >+ subscriptionid => $subscription->{subscriptionid}, >+ budget_id => $budget_id, >+}); >+ >+my $is_currently_on_order = subscriptionCurrentlyOnOrder( $subscription->{subscriptionid} ); >+is ( $is_currently_on_order, 1, "The subscription is currently on order"); >+ >+my $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} ); >+is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order not received"); >+ok( $order->{ecost} == $cost, "test cost for the last order not received"); >+ >+my ( $datereceived, $new_ordernumber ) = ModReceiveOrder( >+ $biblionumber, $ordernumber, 1, undef, $cost, $cost, >+ undef, $cost, $budget_id, '02-01-2013', undef); >+ >+$order = GetLastOrderReceivedFromSubscriptionid( $subscription->{subscriptionid} ); >+is ( $order->{subscriptionid}, $subscription->{subscriptionid}, "test subscriptionid for the last order received"); >+ok( $order->{ecost} == $cost, "test cost for the last order received"); >+ >+$order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscriptionid} ); >+is ( $order, undef, "test no not received order for a received order"); >+ >+# cleaning >+DelSubscription( $subscription->{subscriptionid} ); >+DelOrder( $subscription->{biblionumber}, $ordernumber ); >+DelBudgetPeriod($bpid); >+DelBudget($budget_id); >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index 6ec8b57..717f8fe 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -1,9 +1,8 @@ > use strict; > use warnings; >-use Test::More tests=>17; >+use Test::More tests=>18; > > BEGIN {use_ok('C4::Budgets') } >-use C4::Budgets; > use C4::Dates; > > use YAML; >@@ -99,7 +98,9 @@ ok(GetBudgets({budget_period_id=>$bpid},[{"budget_name"=>0}])>0, > ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{"budget_name"=>0}])>0, > "GetBudgets With Order > Getting Active budgetPeriod OK"); >-ok($del_status=DelBudget($budget_id), >- "DelBudget returned $del_status"); > >+my $budget_name = GetBudgetName( $budget_id ); >+is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine"); > >+ok($del_status=DelBudget($budget_id), >+ "DelBudget returned $del_status"); >-- >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 9937
:
16934
|
17015
| 17053