Bug 10275: UT: OrderFromSubscription.t needs to create its own data

Try before the patch:
prove t/db_dependent/Acquisition/OrderFromSubscription.t

And after, it should produce:
  t/db_dependent/Acquisition/OrderFromSubscription.t .. ok
  All tests successful.
  Files=1, Tests=12,  2 wallclock secs ( 0.02 usr  0.00 sys +  0.46 cusr
  0.02 csys =  0.50 CPU)
  Result: PASS

And some warnings...

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes tests.
Assumes Dateformat is set to US dates as in the sample data.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 8e44295524)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2013-05-17 15:27:45 +02:00 committed by Tomas Cohen Arazi
parent 88c877ab2d
commit 5b1fda0cf3
1 changed files with 30 additions and 11 deletions

View File

@ -1,19 +1,29 @@
use Modern::Perl;
use Test::More tests => 10;
use Test::More tests => 12;
use Data::Dumper;
use_ok('C4::Serials');
use_ok('C4::Budgets');
use_ok('C4::Acquisition');
use_ok('C4::Biblio');
use_ok('C4::Budgets');
use_ok('C4::Serials');
my $supplierlist=eval{GetSuppliersWithLateIssues()};
ok(length($@)==0,"No SQL problem in GetSuppliersWithLateIssues");
my $biblionumber = 1;
my $booksellerid = C4::Bookseller::AddBookseller(
{
name => "my vendor",
address1 => "bookseller's address",
phone => "0123456",
active => 1
}
);
my ($biblionumber, $biblioitemnumber) = AddBiblio(MARC::Record->new, '');
my $budgetid;
my $bpid = AddBudgetPeriod({
budget_period_startdate => '01-01-2015',
budget_period_enddate => '31-12-2015',
budget_period_enddate => '12-31-2015',
budget_description => "budget desc"
});
@ -36,16 +46,21 @@ my $subscriptionid = NewSubscription(
"intnotes", 0, undef, undef, 0, undef, '31-12-2013',
);
die unless $subscriptionid;
my ($basket, $basketno);
ok($basketno = NewBasket($booksellerid, 1), "NewBasket( $booksellerid , 1 ) returns $basketno");
my $cost = 42.00;
my $subscription = GetSubscription( $subscriptionid );
my ( $basketno, $ordernumber ) = NewOrder({
my $ordernumber;
( $basketno, $ordernumber ) = NewOrder({
biblionumber => $subscription->{biblionumber},
entrydate => '01-01-2013',
quantity => 1,
currency => 'USD',
listprice => $cost,
notes => "This is a note",
basketno => 1,
basketno => $basketno,
rrp => $cost,
ecost => $cost,
gstrate => 0.0500,
@ -73,7 +88,11 @@ $order = GetLastOrderNotReceivedFromSubscriptionid( $subscription->{subscription
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);
END {
DelSubscription( $subscription->{subscriptionid} );
DelOrder( $subscription->{biblionumber}, $ordernumber );
DelBudgetPeriod($bpid);
DelBudget($budget_id);
DelBasket( $basketno );
DelBiblio($biblionumber);
};