|
Lines 100-106
is( Koha::Patron::Messages->search->count, $nb_of_messages + 1, 'Delete should h
Link Here
|
| 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 |
102 |
# START BUG-12029 |
| 103 |
my $starting_unread_count = Koha::Patron::Messages->unread_count(); |
103 |
my $starting_unread_count = Koha::Patron::Messages->filter_by_unread()->count(); |
| 104 |
|
104 |
|
| 105 |
my $new_message_4 = Koha::Patron::Message->new( |
105 |
my $new_message_4 = Koha::Patron::Message->new( |
| 106 |
{ |
106 |
{ |
|
Lines 113-129
my $new_message_4 = Koha::Patron::Message->new(
Link Here
|
| 113 |
)->store; |
113 |
)->store; |
| 114 |
|
114 |
|
| 115 |
is( |
115 |
is( |
| 116 |
Koha::Patron::Messages->unread_count(), |
116 |
Koha::Patron::Messages->filter_by_unread()->count(), |
| 117 |
$starting_unread_count + 1, |
117 |
$starting_unread_count + 1, |
| 118 |
"Unread count should return a new count one higher" |
118 |
"Unread count should return a new count one higher" |
| 119 |
); |
119 |
); |
| 120 |
is( |
120 |
is( |
| 121 |
Koha::Patron::Messages->unread->count(), |
121 |
Koha::Patron::Messages->filter_by_unread()->count(), |
| 122 |
$starting_unread_count + 1, |
122 |
$starting_unread_count + 1, |
| 123 |
"Unread should be able to have count called on it and return the same number" |
123 |
"Unread should be able to have count called on it and return the same number" |
| 124 |
); |
124 |
); |
| 125 |
|
125 |
|
| 126 |
ok( ( grep { $_->message eq $new_message_4->message } @{ Koha::Patron::Messages->unread->as_list } ), |
126 |
ok( ( grep { $_->message eq $new_message_4->message } @{ Koha::Patron::Messages->filter_by_unread()->as_list() } ), |
| 127 |
"Unread should return our new_message_4" ); |
127 |
"Unread should return our new_message_4" ); |
| 128 |
|
128 |
|
| 129 |
# Set a message to be read |
129 |
# Set a message to be read |
|
Lines 133-140
$new_message_4->update(
Link Here
|
| 133 |
} |
133 |
} |
| 134 |
); |
134 |
); |
| 135 |
|
135 |
|
| 136 |
is( Koha::Patron::Messages->unread_count(), |
136 |
is( Koha::Patron::Messages->filter_by_unread()->count(), |
| 137 |
$starting_unread_count, "Unread count should return the original count of messages" ); |
137 |
$starting_unread_count, "Unread count should return the original count of messages (run dbic if this fails)." ); |
| 138 |
# END BUG-12029 |
138 |
# END BUG-12029 |
| 139 |
|
139 |
|
| 140 |
|
140 |
|
| 141 |
- |
|
|