forked from Koha-Community/Koha
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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! Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
- Loading branch information
Showing
2 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters