Bug 13554: t/Prices.t shouldn't depend on the DB
authorJonathan Druart <jonathan.druart@biblibre.com>
Mon, 12 Jan 2015 08:35:51 +0000 (09:35 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Sat, 17 Jan 2015 13:30:34 +0000 (10:30 -0300)
To reproduce:
- Stop your MySQL server:
  $ sudo service mysql stop
- Run
  $ prove t/Prices.t
=> FAIL: some tests fail because of mysql stopped

To test (MySQL still stopped)
- Apply the patch
- Run
  $ prove t/Prices.t

Signed-off-by: Paola Rossi <paola.rossi@cineca.it>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/Prices.t

index 3dc6c54..92bb432 100644 (file)
@@ -1,15 +1,17 @@
 use Modern::Perl;
-use Test::More tests => 8;
+use Test::More tests => 12;
 use Test::MockModule;
 
-use C4::Acquisition;
-use C4::Bookseller;
-use C4::Context;
-
-use Koha::Number::Price;
-
 use t::lib::Mocks;
 
+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');
+};
+
 t::lib::Mocks::mock_preference( 'gist', '0.02|0.05|0.196' );
 
 my $bookseller_module = Test::MockModule->new('Koha::Acquisition::Bookseller');