|
Lines 159-170
my $my_suggestion_without_suggestedby = {
Link Here
|
| 159 |
quantity => '', # Insert an empty string into int to catch strict SQL modes errors |
159 |
quantity => '', # Insert an empty string into int to catch strict SQL modes errors |
| 160 |
}; |
160 |
}; |
| 161 |
|
161 |
|
| 162 |
is( CountSuggestion(), 0, 'CountSuggestion without the status returns 0' ); |
|
|
| 163 |
is( CountSuggestion('ASKED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
| 164 |
is( CountSuggestion('CHECKED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
| 165 |
is( CountSuggestion('ACCEPTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
| 166 |
is( CountSuggestion('REJECTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
| 167 |
|
| 168 |
my $my_suggestionid = NewSuggestion($my_suggestion); |
162 |
my $my_suggestionid = NewSuggestion($my_suggestion); |
| 169 |
isnt( $my_suggestionid, 0, 'NewSuggestion returns an not null id' ); |
163 |
isnt( $my_suggestionid, 0, 'NewSuggestion returns an not null id' ); |
| 170 |
my $my_suggestionid_with_budget = NewSuggestion($my_suggestion_with_budget); |
164 |
my $my_suggestionid_with_budget = NewSuggestion($my_suggestion_with_budget); |
|
Lines 181-189
is( $suggestion->{managedby}, undef, 'NewSuggestion stores empty string as undef
Link Here
|
| 181 |
is( $suggestion->{manageddate}, undef, 'NewSuggestion stores empty string as undef for date' ); |
175 |
is( $suggestion->{manageddate}, undef, 'NewSuggestion stores empty string as undef for date' ); |
| 182 |
is( $suggestion->{budgetid}, undef, 'NewSuggestion should set budgetid to NULL if not given' ); |
176 |
is( $suggestion->{budgetid}, undef, 'NewSuggestion should set budgetid to NULL if not given' ); |
| 183 |
|
177 |
|
| 184 |
is( CountSuggestion('ASKED'), 2, 'CountSuggestion returns the correct number of suggestions' ); |
|
|
| 185 |
|
| 186 |
|
| 187 |
is( ModSuggestion(), undef, 'ModSuggestion without the suggestion returns undef' ); |
178 |
is( ModSuggestion(), undef, 'ModSuggestion without the suggestion returns undef' ); |
| 188 |
my $mod_suggestion1 = { |
179 |
my $mod_suggestion1 = { |
| 189 |
title => 'my modified title', |
180 |
title => 'my modified title', |
|
Lines 239-245
$messages = C4::Letters::GetQueuedMessages({
Link Here
|
| 239 |
}); |
230 |
}); |
| 240 |
is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); |
231 |
is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); |
| 241 |
is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is disabled the suggestion message_transport_type is always email'); |
232 |
is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is disabled the suggestion message_transport_type is always email'); |
| 242 |
is( CountSuggestion('CHECKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); |
|
|
| 243 |
|
233 |
|
| 244 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
234 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
| 245 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
235 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
|
Lines 413-420
my $del_suggestion = {
Link Here
|
| 413 |
}; |
403 |
}; |
| 414 |
my $del_suggestionid = NewSuggestion($del_suggestion); |
404 |
my $del_suggestionid = NewSuggestion($del_suggestion); |
| 415 |
|
405 |
|
| 416 |
is( CountSuggestion('CHECKED'), 3, 'CountSuggestion returns the correct number of suggestions' ); |
|
|
| 417 |
|
| 418 |
is( DelSuggestion(), '0E0', 'DelSuggestion without arguments returns 0E0' ); |
406 |
is( DelSuggestion(), '0E0', 'DelSuggestion without arguments returns 0E0' ); |
| 419 |
is( DelSuggestion($borrowernumber), '', 'DelSuggestion without the suggestion id returns an empty string' ); |
407 |
is( DelSuggestion($borrowernumber), '', 'DelSuggestion without the suggestion id returns an empty string' ); |
| 420 |
is( DelSuggestion(undef, $my_suggestionid), '', 'DelSuggestion with an invalid borrower number returns an empty string' ); |
408 |
is( DelSuggestion(undef, $my_suggestionid), '', 'DelSuggestion with an invalid borrower number returns an empty string' ); |
| 421 |
- |
|
|