1976ec2020
The GetLetters subroutine should return an arrayref with different letters for a module. Test plan: 0/ Delete your notices with module=claimacquisition, claimissues, serial 1/ Go on the late orders page (acqui/lateorders.pl) and verify you cannot choose a notice for claiming 2/ Create a notice with module=claimacquisition 3/ Go on the late orders page (acqui/lateorders.pl) and verify you can choose the notice for claiming 4/ Go on the Claim serials page (serials/claims.pl) and repeat the same thing with the a "claimissues" notice 5/ Create a new subscription (serials/subscription-add.pl) and verify you cannot choose a notification for patrons. 6/ Create a notice with module "serial" and verify you can. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script. Additional tests done: - copy notice ODUE, on saving you are now prompted to choose a new CODE for the notice - edit new notice, try to set code back to ODUE. You are prompted that the code is already in use. This will prevent people from accidentally overwriting a letter with the same letter code.
46 lines
1.4 KiB
Perl
Executable file
46 lines
1.4 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
#
|
|
# This Koha test module is a stub!
|
|
# Add more tests here!!!
|
|
|
|
use Modern::Perl;
|
|
use DBI;
|
|
use Test::MockModule;
|
|
use Test::More tests => 4;
|
|
use t::lib::Mocks;
|
|
my $module = new Test::MockModule('C4::Context');
|
|
$module->mock(
|
|
'_new_dbh',
|
|
sub {
|
|
my $dbh = DBI->connect( 'DBI:Mock:', '', '' )
|
|
|| die "Cannot create handle: $DBI::errstr\n";
|
|
return $dbh;
|
|
}
|
|
);
|
|
my $mock_letters = [
|
|
[ 'module', 'code', 'branchcode', 'name', 'is_html', 'title', 'content' ],
|
|
[ 'blah', 'ISBN', 'NBSI', 'book', 1, 'green', 'blahblah' ],
|
|
[ 'bleh', 'ISSN', 'NSSI', 'page', 0, 'blue', 'blehbleh' ]
|
|
];
|
|
|
|
use_ok('C4::Letters');
|
|
|
|
my $dbh = C4::Context->dbh();
|
|
|
|
$dbh->{mock_add_resultset} = $mock_letters;
|
|
|
|
my $letters = C4::Letters::GetLetters();
|
|
|
|
my ( $ISBN_letter ) = grep {$_->{code} eq 'ISBN'} @$letters;
|
|
is( $ISBN_letter->{name}, 'book', 'letter name for "ISBN" letter is book' );
|
|
is( scalar( @$letters ), 2, 'GetLetters returns the 2 inserted letters' );
|
|
|
|
# Regression test for bug 10843
|
|
# $dt->add takes a scalar, not undef
|
|
my $letter;
|
|
t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', undef);
|
|
$letter = C4::Letters::_parseletter( undef, 'reserves', {waitingdate => "2013-01-01"} );
|
|
is( ref($letter), 'HASH');
|
|
t::lib::Mocks::mock_preference('ReservesMaxPickUpDelay', 1);
|
|
$letter = C4::Letters::_parseletter( undef, 'reserves', {waitingdate => "2013-01-01"} );
|
|
is( ref($letter), 'HASH');
|