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

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

Return to bug 5327