View | Details | Raw Unified | Return to bug 14778
Collapse All | Expand All

(-)a/t/Letters.t (-19 / +18 lines)
Lines 19-46 use Modern::Perl; Link Here
19
19
20
use DBI;
20
use DBI;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::More tests => 5;
22
use Test::More tests => 6;
23
24
use Test::DBIx::Class {
25
    schema_class => 'Koha::Schema',
26
    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
27
    connect_opts => { name_sep => '.', quote_char => '`', },
28
    fixture_class => '::Populate',
29
}, 'Letter' ;
23
use t::lib::Mocks;
30
use t::lib::Mocks;
24
my $module = new Test::MockModule('C4::Context');
25
$module->mock(
26
    '_new_dbh',
27
    sub {
28
        my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
29
          || die "Cannot create handle: $DBI::errstr\n";
30
        return $dbh;
31
    }
32
);
33
my $mock_letters = [
34
    [ 'module', 'code', 'branchcode', 'name', 'is_html', 'title', 'content' ],
35
    [ 'blah',   'ISBN', 'NBSI',       'book', 1,         'green', 'blahblah' ],
36
    [ 'bleh',   'ISSN', 'NSSI',       'page', 0,         'blue',  'blehbleh' ]
37
];
38
31
39
use_ok('C4::Letters');
32
fixtures_ok [
33
    Letter => [
34
        [ 'module', 'code', 'branchcode', 'name', 'is_html', 'title', 'content' ],
35
        [ 'blah',   'ISBN', 'NBSI',       'book', 1,         'green', 'blahblah' ],
36
        [ 'bleh',   'ISSN', 'NSSI',       'page', 0,         'blue',  'blehbleh' ]
37
    ],
38
], 'add fixtures';
40
39
41
my $dbh = C4::Context->dbh();
40
my $db = Test::MockModule->new('Koha::Database');
41
$db->mock( _new_schema => sub { return Schema(); } );
42
42
43
$dbh->{mock_add_resultset} = $mock_letters;
43
use_ok('C4::Letters');
44
44
45
t::lib::Mocks::mock_preference('dateformat', 'metric');
45
t::lib::Mocks::mock_preference('dateformat', 'metric');
46
46
47
- 

Return to bug 14778