Lines 407-434
subtest "NoIssuesChargeGuarantorsWithGuarantees tests" => sub {
Link Here
|
407 |
}; |
407 |
}; |
408 |
|
408 |
|
409 |
subtest "Patron messages tests" => sub { |
409 |
subtest "Patron messages tests" => sub { |
410 |
plan tests => 1; |
410 |
plan tests => 2; |
411 |
$schema->storage->txn_begin; |
411 |
$schema->storage->txn_begin; |
412 |
my $today = output_pref({ dt => dt_from_string(), dateonly => 1}); |
412 |
my $today = output_pref( { dt => dt_from_string(), dateonly => 1 } ); |
413 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
413 |
my $patron = $builder->build_object( { class => 'Koha::Patrons', value => { opacnote => q{} } } ); |
414 |
my $library = $builder->build_object ({ class => 'Koha::Libraries' }); |
414 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
415 |
my $new_message_1 = Koha::Patron::Message->new( |
415 |
my $new_message_1 = Koha::Patron::Message->new( |
416 |
{ borrowernumber => $patron->id, |
416 |
{ |
417 |
branchcode => $library->branchcode, |
417 |
borrowernumber => $patron->id, |
418 |
message_type => 'B', |
418 |
branchcode => $library->branchcode, |
419 |
message => 'my message 1', |
419 |
message_type => 'B', |
420 |
})->store; |
420 |
message => 'my message 1', |
421 |
|
421 |
} |
422 |
my $new_message_2 = Koha::Patron::Message->new( |
422 |
)->store; |
423 |
{ borrowernumber => $patron->id, |
|
|
424 |
branchcode => $library->branchcode, |
425 |
message_type => 'B', |
426 |
message => 'my message 2', |
427 |
})->store; |
428 |
|
423 |
|
|
|
424 |
my $new_message_2 = Koha::Patron::Message->new( |
425 |
{ |
426 |
borrowernumber => $patron->id, |
427 |
branchcode => $library->branchcode, |
428 |
message_type => 'B', |
429 |
message => 'my message 2', |
430 |
} |
431 |
)->store; |
429 |
|
432 |
|
|
|
433 |
t::lib::Mocks::mock_preference( 'SIP2AddOpacMessagesToScreenMessage', 0 ); |
430 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
434 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
431 |
like( $sip_patron->screen_msg, qr/Messages for you: $today: my message 1 \/ $today: my message 2/,"Screen message includes patron messages"); |
435 |
is( $sip_patron->screen_msg, 'Greetings from Koha. ' ); |
|
|
436 |
|
437 |
t::lib::Mocks::mock_preference( 'SIP2AddOpacMessagesToScreenMessage', 1 ); |
438 |
$sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
439 |
like( |
440 |
$sip_patron->screen_msg, qr/Messages for you: $today: my message 1 \/ $today: my message 2/, |
441 |
"Screen message includes patron messages" |
442 |
); |
432 |
|
443 |
|
433 |
$schema->storage->txn_rollback; |
444 |
$schema->storage->txn_rollback; |
434 |
}; |
445 |
}; |
435 |
- |
|
|