Lines 6-11
use Test::More tests => 86;
Link Here
|
6 |
use Test::MockModule; |
6 |
use Test::MockModule; |
7 |
use Test::Warn; |
7 |
use Test::Warn; |
8 |
|
8 |
|
|
|
9 |
use t::lib::TestBuilder; |
10 |
|
9 |
use C4::Context; |
11 |
use C4::Context; |
10 |
use Koha::DateUtils; |
12 |
use Koha::DateUtils; |
11 |
use DateTime::Duration; |
13 |
use DateTime::Duration; |
Lines 35-42
my $dbh = C4::Context->dbh;
Link Here
|
35 |
my $database = Koha::Database->new(); |
37 |
my $database = Koha::Database->new(); |
36 |
my $schema = $database->schema(); |
38 |
my $schema = $database->schema(); |
37 |
$schema->storage->txn_begin(); |
39 |
$schema->storage->txn_begin(); |
38 |
|
|
|
39 |
$dbh->{RaiseError} = 1; |
40 |
$dbh->{RaiseError} = 1; |
|
|
41 |
my $builder = t::lib::TestBuilder->new; |
40 |
|
42 |
|
41 |
#Start tests |
43 |
#Start tests |
42 |
$dbh->do(q|DELETE FROM aqorders|); |
44 |
$dbh->do(q|DELETE FROM aqorders|); |
Lines 44-49
$dbh->do(q|DELETE FROM aqbasket|);
Link Here
|
44 |
$dbh->do(q|DELETE FROM aqbooksellers|); |
46 |
$dbh->do(q|DELETE FROM aqbooksellers|); |
45 |
$dbh->do(q|DELETE FROM subscription|); |
47 |
$dbh->do(q|DELETE FROM subscription|); |
46 |
|
48 |
|
|
|
49 |
# Add currency |
50 |
my $curcode = $builder->build({ source => 'Currency' })->{currencycode}; |
51 |
|
47 |
#Test AddBookseller |
52 |
#Test AddBookseller |
48 |
my $count = Koha::Acquisition::Booksellers->search()->count(); |
53 |
my $count = Koha::Acquisition::Booksellers->search()->count(); |
49 |
my $sample_supplier1 = { |
54 |
my $sample_supplier1 = { |
Lines 350-356
my $order1 = Koha::Acquisition::Order->new(
Link Here
|
350 |
biblionumber => $biblionumber, |
355 |
biblionumber => $biblionumber, |
351 |
budget_id => $id_budget, |
356 |
budget_id => $id_budget, |
352 |
entrydate => '01-01-2013', |
357 |
entrydate => '01-01-2013', |
353 |
currency => 'EUR', |
358 |
currency => $curcode, |
354 |
notes => "This is a note1", |
359 |
notes => "This is a note1", |
355 |
tax_rate => 0.0500, |
360 |
tax_rate => 0.0500, |
356 |
orderstatus => 1, |
361 |
orderstatus => 1, |
Lines 370-376
my $order2 = Koha::Acquisition::Order->new(
Link Here
|
370 |
biblionumber => $biblionumber, |
375 |
biblionumber => $biblionumber, |
371 |
budget_id => $id_budget, |
376 |
budget_id => $id_budget, |
372 |
entrydate => '01-01-2013', |
377 |
entrydate => '01-01-2013', |
373 |
currency => 'EUR', |
378 |
currency => $curcode, |
374 |
notes => "This is a note2", |
379 |
notes => "This is a note2", |
375 |
tax_rate => 0.0500, |
380 |
tax_rate => 0.0500, |
376 |
orderstatus => 1, |
381 |
orderstatus => 1, |
Lines 388-394
my $order3 = Koha::Acquisition::Order->new(
Link Here
|
388 |
biblionumber => $biblionumber, |
393 |
biblionumber => $biblionumber, |
389 |
budget_id => $id_budget, |
394 |
budget_id => $id_budget, |
390 |
entrydate => '02-02-2013', |
395 |
entrydate => '02-02-2013', |
391 |
currency => 'EUR', |
396 |
currency => $curcode, |
392 |
notes => "This is a note3", |
397 |
notes => "This is a note3", |
393 |
tax_rate => 0.0500, |
398 |
tax_rate => 0.0500, |
394 |
orderstatus => 2, |
399 |
orderstatus => 2, |
Lines 406-412
my $order4 = Koha::Acquisition::Order->new(
Link Here
|
406 |
biblionumber => $biblionumber, |
411 |
biblionumber => $biblionumber, |
407 |
budget_id => $id_budget, |
412 |
budget_id => $id_budget, |
408 |
entrydate => '02-02-2013', |
413 |
entrydate => '02-02-2013', |
409 |
currency => 'EUR', |
414 |
currency => $curcode, |
410 |
notes => "This is a note3", |
415 |
notes => "This is a note3", |
411 |
tax_rate => 0.0500, |
416 |
tax_rate => 0.0500, |
412 |
orderstatus => 2, |
417 |
orderstatus => 2, |