Bug 9031: (QA follow-up) Pass the same timezone in Calendar.t
[koha.git] / t / db_dependent / Bookseller.t
index 77cf3ef..416974c 100644 (file)
@@ -6,6 +6,8 @@ use Test::More tests => 86;
 use Test::MockModule;
 use Test::Warn;
 
+use t::lib::TestBuilder;
+
 use C4::Context;
 use Koha::DateUtils;
 use DateTime::Duration;
@@ -16,7 +18,7 @@ use C4::Budgets;
 use C4::Biblio;
 
 use Koha::Acquisition::Booksellers;
-use Koha::Acquisition::Order;
+use Koha::Acquisition::Orders;
 use Koha::Database;
 
 BEGIN {
@@ -35,8 +37,8 @@ my $dbh = C4::Context->dbh;
 my $database = Koha::Database->new();
 my $schema = $database->schema();
 $schema->storage->txn_begin();
-
 $dbh->{RaiseError} = 1;
+my $builder = t::lib::TestBuilder->new;
 
 #Start tests
 $dbh->do(q|DELETE FROM aqorders|);
@@ -44,6 +46,9 @@ $dbh->do(q|DELETE FROM aqbasket|);
 $dbh->do(q|DELETE FROM aqbooksellers|);
 $dbh->do(q|DELETE FROM subscription|);
 
+# Add currency
+my $curcode = $builder->build({ source => 'Currency' })->{currencycode};
+
 #Test AddBookseller
 my $count            = Koha::Acquisition::Booksellers->search()->count();
 my $sample_supplier1 = {
@@ -124,7 +129,7 @@ for my $bookseller ( @booksellers ) {
 
 $sample_supplier1->{id} = $id_supplier1;
 is( scalar(@booksellers), $count + 2, "Get  Supplier1 and Supplier2" );
-my @tab = ( $sample_supplier1, $sample_supplier2 );
+my @tab = ( $sample_supplier2, $sample_supplier1 );
 is_deeply( \@booksellers, \@tab,
     "Returns right fields of Supplier1 and Supplier2" );
 
@@ -350,7 +355,7 @@ my $order1 = Koha::Acquisition::Order->new(
         biblionumber     => $biblionumber,
         budget_id        => $id_budget,
         entrydate        => '01-01-2013',
-        currency         => 'EUR',
+        currency         => $curcode,
         notes            => "This is a note1",
         tax_rate          => 0.0500,
         orderstatus      => 1,
@@ -360,8 +365,8 @@ my $order1 = Koha::Acquisition::Order->new(
         ecost            => 10,
         datereceived     => '01-06-2013'
     }
-)->insert;
-my $ordernumber1 = $order1->{ordernumber};
+)->store;
+my $ordernumber1 = $order1->ordernumber;
 
 my $order2 = Koha::Acquisition::Order->new(
     {
@@ -370,7 +375,7 @@ my $order2 = Koha::Acquisition::Order->new(
         biblionumber   => $biblionumber,
         budget_id      => $id_budget,
         entrydate      => '01-01-2013',
-        currency       => 'EUR',
+        currency       => $curcode,
         notes          => "This is a note2",
         tax_rate        => 0.0500,
         orderstatus    => 1,
@@ -378,8 +383,8 @@ my $order2 = Koha::Acquisition::Order->new(
         rrp            => 10,
         ecost          => 10,
     }
-)->insert;
-my $ordernumber2 = $order2->{ordernumber};
+)->store;
+my $ordernumber2 = $order2->ordernumber;
 
 my $order3 = Koha::Acquisition::Order->new(
     {
@@ -388,7 +393,7 @@ my $order3 = Koha::Acquisition::Order->new(
         biblionumber   => $biblionumber,
         budget_id      => $id_budget,
         entrydate      => '02-02-2013',
-        currency       => 'EUR',
+        currency       => $curcode,
         notes          => "This is a note3",
         tax_rate        => 0.0500,
         orderstatus    => 2,
@@ -396,8 +401,8 @@ my $order3 = Koha::Acquisition::Order->new(
         rrp            => 11,
         ecost          => 11,
     }
-)->insert;
-my $ordernumber3 = $order3->{ordernumber};
+)->store;
+my $ordernumber3 = $order3->ordernumber;
 
 my $order4 = Koha::Acquisition::Order->new(
     {
@@ -406,7 +411,7 @@ my $order4 = Koha::Acquisition::Order->new(
         biblionumber     => $biblionumber,
         budget_id        => $id_budget,
         entrydate        => '02-02-2013',
-        currency         => 'EUR',
+        currency         => $curcode,
         notes            => "This is a note3",
         tax_rate          => 0.0500,
         orderstatus      => 2,
@@ -415,8 +420,8 @@ my $order4 = Koha::Acquisition::Order->new(
         ecost            => 11,
         quantityreceived => 20
     }
-)->insert;
-my $ordernumber4 = $order4->{ordernumber};
+)->store;
+my $ordernumber4 = $order4->ordernumber;
 
 #Test cases:
 # Sample datas :