Lines 19-25
use Modern::Perl;
Link Here
|
19 |
|
19 |
|
20 |
use DateTime::Duration; |
20 |
use DateTime::Duration; |
21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
22 |
use Test::More tests => 50; |
22 |
use Test::More tests => 44; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use t::lib::Mocks; |
25 |
use t::lib::Mocks; |
Lines 38-44
use Koha::Suggestions;
Link Here
|
38 |
BEGIN { |
38 |
BEGIN { |
39 |
use_ok( |
39 |
use_ok( |
40 |
'C4::Suggestions', |
40 |
'C4::Suggestions', |
41 |
qw( ModSuggestion DelSuggestion MarcRecordFromNewSuggestion ) |
41 |
qw( ModSuggestion MarcRecordFromNewSuggestion ) |
42 |
); |
42 |
); |
43 |
} |
43 |
} |
44 |
|
44 |
|
Lines 320-337
my $del_suggestion = {
Link Here
|
320 |
my $del_suggestion_object = Koha::Suggestion->new($del_suggestion)->store(); |
320 |
my $del_suggestion_object = Koha::Suggestion->new($del_suggestion)->store(); |
321 |
my $del_suggestionid = $del_suggestion_object->id; |
321 |
my $del_suggestionid = $del_suggestion_object->id; |
322 |
|
322 |
|
323 |
is( DelSuggestion(), '0E0', 'DelSuggestion without arguments returns 0E0' ); |
|
|
324 |
is( DelSuggestion($borrowernumber), '', 'DelSuggestion without the suggestion id returns an empty string' ); |
325 |
is( |
326 |
DelSuggestion( undef, $my_suggestionid ), '', |
327 |
'DelSuggestion with an invalid borrower number returns an empty string' |
328 |
); |
329 |
$suggestion = DelSuggestion( $borrowernumber, $my_suggestionid ); |
330 |
is( $suggestion, 1, 'DelSuggestion deletes one suggestion' ); |
331 |
|
332 |
my $suggestions = Koha::Suggestions->search( { STATUS => 'CHECKED' } )->as_list; |
323 |
my $suggestions = Koha::Suggestions->search( { STATUS => 'CHECKED' } )->as_list; |
333 |
is( @$suggestions, 2, 'DelSuggestion deletes one suggestion' ); |
|
|
334 |
is( $suggestions->[1]->unblessed()->{title}, $del_suggestion->{title}, 'DelSuggestion deletes the correct suggestion' ); |
335 |
|
324 |
|
336 |
# Test budgetid fk |
325 |
# Test budgetid fk |
337 |
$my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB |
326 |
$my_suggestion->{budgetid} = ''; # If budgetid == '', NULL should be set in DB |
338 |
- |
|
|