Bug 7180: (follow-up) fix getAuthValueDropbox should display the selected value
[koha.git] / t / Letters.t
blob7cbf6c8e868c25d08bf405a9e4d4e549a5da757b
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use Modern::Perl;
7 use DBI;
8 use Test::MockModule;
9 use Test::More tests => 4;
10 use t::lib::Mocks;
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;
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' ]
26 use_ok('C4::Letters');
28 my $dbh = C4::Context->dbh();
30 $dbh->{mock_add_resultset} = $mock_letters;
32 my $letters = C4::Letters::GetLetters();
34 is( $letters->{ISBN}, 'book', 'HASH ref of ISBN is book' );
36 # Regression test for bug 10843
37 # $dt->add takes a scalar, not undef
38 my $letter;
39 t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', undef);
40 $letter = C4::Letters::_parseletter( undef, 'reserves', {waitingdate => "2013-01-01"} );
41 is( ref($letter), 'HASH');
42 t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', 1);
43 $letter = C4::Letters::_parseletter( undef, 'reserves', {waitingdate => "2013-01-01"} );
44 is( ref($letter), 'HASH');