Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 12; |
22 |
use Test::More tests => 14; |
23 |
|
23 |
|
24 |
use C4::Context; |
24 |
use C4::Context; |
25 |
use Koha::ActionLogs; |
25 |
use Koha::ActionLogs; |
Lines 27-32
use Koha::Patron::Message;
Link Here
|
27 |
use Koha::Patron::Messages; |
27 |
use Koha::Patron::Messages; |
28 |
use Koha::Patrons; |
28 |
use Koha::Patrons; |
29 |
use Koha::Database; |
29 |
use Koha::Database; |
|
|
30 |
use Koha::DateUtils qw( dt_from_string ); |
30 |
|
31 |
|
31 |
use t::lib::Mocks; |
32 |
use t::lib::Mocks; |
32 |
use t::lib::TestBuilder; |
33 |
use t::lib::TestBuilder; |
Lines 99-104
$new_message_2->delete;
Link Here
|
99 |
is( Koha::Patron::Messages->search->count, $nb_of_messages + 1, 'Delete should have deleted the message 2' ); |
100 |
is( Koha::Patron::Messages->search->count, $nb_of_messages + 1, 'Delete should have deleted the message 2' ); |
100 |
is( get_nb_of_logactions(), $nb_of_logaction + 3, 'With BorrowersLog on, 1 new log should have been added when deleting a new message' ); |
101 |
is( get_nb_of_logactions(), $nb_of_logaction + 3, 'With BorrowersLog on, 1 new log should have been added when deleting a new message' ); |
101 |
|
102 |
|
|
|
103 |
my $new_message_4 = Koha::Patron::Message->new( |
104 |
{ borrowernumber => $patron->{borrowernumber}, |
105 |
branchcode => $library->{branchcode}, |
106 |
message_type => 'B', |
107 |
message => 'my message 2', |
108 |
manager_id => $patron_3->{borrowernumber}, |
109 |
} |
110 |
)->store; |
111 |
my $patron_obj = Koha::Patrons->find( $patron->{borrowernumber} ); |
112 |
my $current_messages_count = $patron_obj->messages->count; |
113 |
is( $patron_obj->messages->filter_by_unread->count, $current_messages_count, "No messages have been marked as read" ); |
114 |
$new_message_4->update({ patron_read_date => dt_from_string }); |
115 |
is( $patron_obj->messages->filter_by_unread->count, $current_messages_count - 1, "One message has been marked as read" ); |
116 |
$new_message_4->update({ patron_read_date => undef }); |
117 |
|
102 |
$schema->storage->txn_rollback; |
118 |
$schema->storage->txn_rollback; |
103 |
|
119 |
|
104 |
sub get_nb_of_logactions { |
120 |
sub get_nb_of_logactions { |
105 |
- |
|
|