Bug 16769: Uniformise calls to Koha::Cache->set_in_cache
[koha.git] / t / Prices.t
index 7ba1cc1..74d2eac 100644 (file)
@@ -1,19 +1,43 @@
 use Modern::Perl;
-use Test::More tests => 16;
+use Test::More;
 use Test::MockModule;
 
 use t::lib::Mocks;
 
+use Module::Load::Conditional qw/check_install/;
+
 BEGIN {
-    my $context_module = t::lib::Mocks::mock_dbh;
-    use_ok('C4::Acquisition');
-    use_ok('C4::Bookseller');
-    use_ok('C4::Context');
-    use_ok('Koha::Number::Price');
-};
+    if ( check_install( module => 'Test::DBIx::Class' ) ) {
+        plan tests => 17;
+    } else {
+        plan skip_all => "Need Test::DBIx::Class"
+    }
+}
+
+use_ok('C4::Acquisition');
+use_ok('C4::Bookseller');
+use_ok('C4::Context');
+use_ok('Koha::Number::Price');
 
 t::lib::Mocks::mock_preference( 'gist', '0.02|0.05|0.196' );
 
+use Test::DBIx::Class {
+    schema_class => 'Koha::Schema',
+    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
+    connect_opts => { name_sep => '.', quote_char => '`', },
+    fixture_class => '::Populate',
+}, 'Currency' ;
+
+my $db = Test::MockModule->new('Koha::Database');
+$db->mock( _new_schema => sub { return Schema(); } );
+
+fixtures_ok [
+    Currency => [
+        [ qw/ currency symbol rate active / ],
+        [[ 'my_cur', '€', 1, 1, ]],
+    ],
+], 'add currency fixtures';
+
 my $bookseller_module = Test::MockModule->new('Koha::Acquisition::Bookseller');
 
 my ( $basketno_0_0,  $basketno_1_1,  $basketno_1_0,  $basketno_0_1 );