Bug 8215: Followup FIX QA issues
[koha.git] / t / Letters.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8 use Test::MockModule;
9 use Test::More tests => 2;
10
11 my $module = new Test::MockModule('C4::Context');
12 $module->mock(
13     '_new_dbh',
14     sub {
15         my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
16           || die "Cannot create handle: $DBI::errstr\n";
17         return $dbh;
18     }
19 );
20 my $mock_letters = [
21     [ 'module', 'code', 'branchcode', 'name', 'is_html', 'title', 'content' ],
22     [ 'blah',   'ISBN', 'NBSI',       'book', 1,         'green', 'blahblah' ],
23     [ 'bleh',   'ISSN', 'NSSI',       'page', 0,         'blue',  'blehbleh' ]
24 ];
25
26 use_ok('C4::Letters');
27
28 my $dbh = C4::Context->dbh();
29
30 $dbh->{mock_add_resultset} = $mock_letters;
31
32 my $letters = C4::Letters::GetLetters();
33
34 is( $letters->{ISBN}, 'book', 'HASH ref of ISBN is book' );