Bug 15323: Use fixtures for the active currency

prove t/Prices.t
fails after bug 15084 has been pushed
It's caused by
  commit 1538e9ecf4
    Bug 15084: Replace C4::Budgets::GetCurrencies with
    Koha::Acquisition::Currencies->search

Koha::Number::Price->_format_params calls
Koha::Acquisition::Currencies->get_active, which requests the DB.
The currency data should be mocked.

Test plan:
sudo service mysql stop
prove t/Prices.t
 should return green

Signed-off-by: Tomas Cohen Arazi <tomascohen@unc.edu.ar>
Patch works as expected and passes the qa-tools tests.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit 0a14e22d59)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-03-30 11:30:01 +01:00 committed by Julian Maurice
parent 97de8be704
commit c4c7ea475b
1 changed files with 18 additions and 2 deletions

View File

@ -1,11 +1,10 @@
use Modern::Perl;
use Test::More tests => 16;
use Test::More tests => 17;
use Test::MockModule;
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');
@ -14,6 +13,23 @@ BEGIN {
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 );