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

(-)a/t/Letters.t (-3 / +20 lines)
Lines 5-14 Link 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('_new_dbh', sub {
17
                             my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
18
                             || die "Cannot create handle: $DBI::errstr\n";
19
                             return $dbh });
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
my $dbh = C4::Context->dbh();
27
28
$dbh->{mock_add_resultset} = $mock_letters;
29
30
my $letters=C4::Letters::GetLetters();
31
32
is($letters->{ISBN},'book', 'HASH ref of ISBN is book');

Return to bug 5327