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 => 16; |
23 |
|
23 |
|
24 |
use C4::Context; |
24 |
use C4::Context; |
25 |
use Koha::ActionLogs; |
25 |
use Koha::ActionLogs; |
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' ); |
99 |
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' ); |
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 |
|
101 |
|
|
|
102 |
# START BUG-12029 |
103 |
my $starting_unread_count = Koha::Patron::Messages->unread_count(); |
104 |
|
105 |
my $new_message_4 = Koha::Patron::Message->new( |
106 |
{ |
107 |
borrowernumber => $patron->{borrowernumber}, |
108 |
branchcode => $library->{branchcode}, |
109 |
message_type => 'B', |
110 |
message => 'testing unread', |
111 |
manager_id => $patron_3->{borrowernumber}, |
112 |
} |
113 |
)->store; |
114 |
|
115 |
is( |
116 |
Koha::Patron::Messages->unread_count(), |
117 |
$starting_unread_count + 1, |
118 |
"Unread count should return a new count one higher" |
119 |
); |
120 |
is( |
121 |
Koha::Patron::Messages->unread->count(), |
122 |
$starting_unread_count + 1, |
123 |
"Unread should be able to have count called on it and return the same number" |
124 |
); |
125 |
|
126 |
ok( ( grep { $_->message eq $new_message_4->message } @{ Koha::Patron::Messages->unread->as_list } ), |
127 |
"Unread should return our new_message_4" ); |
128 |
|
129 |
# Set a message to be read |
130 |
$new_message_4->update( |
131 |
{ |
132 |
patron_read_date => \'NOW()', |
133 |
} |
134 |
); |
135 |
|
136 |
is( Koha::Patron::Messages->unread_count(), |
137 |
$starting_unread_count, "Unread count should return the original count of messages" ); |
138 |
# END BUG-12029 |
139 |
|
140 |
|
102 |
$schema->storage->txn_rollback; |
141 |
$schema->storage->txn_rollback; |
103 |
|
142 |
|
104 |
sub get_nb_of_logactions { |
143 |
sub get_nb_of_logactions { |
105 |
- |
|
|