Lines 21-27
use C4::Context;
Link Here
|
21 |
use C4::Members; |
21 |
use C4::Members; |
22 |
use C4::Letters; |
22 |
use C4::Letters; |
23 |
|
23 |
|
24 |
use Test::More tests => 91; |
24 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
25 |
|
26 |
use Test::More tests => 97; |
25 |
use Test::Warn; |
27 |
use Test::Warn; |
26 |
|
28 |
|
27 |
BEGIN { |
29 |
BEGIN { |
Lines 57-62
my $my_suggestion = {
Link Here
|
57 |
publishercode => 'my publishercode', |
59 |
publishercode => 'my publishercode', |
58 |
suggestedby => $borrowernumber, |
60 |
suggestedby => $borrowernumber, |
59 |
biblionumber => $biblionumber1, |
61 |
biblionumber => $biblionumber1, |
|
|
62 |
managedby => '', |
63 |
manageddate => '', |
64 |
accepteddate => dt_from_string, |
65 |
note => 'my note', |
60 |
}; |
66 |
}; |
61 |
|
67 |
|
62 |
|
68 |
|
Lines 66-72
is( CountSuggestion('CHECKED'), 0, 'CountSuggestion returns the correct number o
Link Here
|
66 |
is( CountSuggestion('ACCEPTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
72 |
is( CountSuggestion('ACCEPTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
67 |
is( CountSuggestion('REJECTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
73 |
is( CountSuggestion('REJECTED'), 0, 'CountSuggestion returns the correct number of suggestions' ); |
68 |
|
74 |
|
69 |
|
|
|
70 |
my $my_suggestionid = NewSuggestion($my_suggestion); |
75 |
my $my_suggestionid = NewSuggestion($my_suggestion); |
71 |
isnt( $my_suggestionid, 0, 'NewSuggestion returns an not null id' ); |
76 |
isnt( $my_suggestionid, 0, 'NewSuggestion returns an not null id' ); |
72 |
|
77 |
|
Lines 78-84
is( $suggestion->{publishercode}, $my_suggestion->{publishercode}, 'NewSuggestio
Link Here
|
78 |
is( $suggestion->{suggestedby}, $my_suggestion->{suggestedby}, 'NewSuggestion stores the borrower number correctly' ); |
83 |
is( $suggestion->{suggestedby}, $my_suggestion->{suggestedby}, 'NewSuggestion stores the borrower number correctly' ); |
79 |
is( $suggestion->{biblionumber}, $my_suggestion->{biblionumber}, 'NewSuggestion stores the biblio number correctly' ); |
84 |
is( $suggestion->{biblionumber}, $my_suggestion->{biblionumber}, 'NewSuggestion stores the biblio number correctly' ); |
80 |
is( $suggestion->{STATUS}, 'ASKED', 'NewSuggestion stores a suggestion with the status ASKED by default' ); |
85 |
is( $suggestion->{STATUS}, 'ASKED', 'NewSuggestion stores a suggestion with the status ASKED by default' ); |
81 |
|
86 |
is( $suggestion->{managedby}, undef, 'NewSuggestion stores empty string as undef for non existent foreign key (integer)' ); |
|
|
87 |
is( $suggestion->{manageddate}, undef, 'NewSuggestion stores empty string as undef for date' ); |
82 |
is( CountSuggestion('ASKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); |
88 |
is( CountSuggestion('ASKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); |
83 |
|
89 |
|
84 |
|
90 |
|
Lines 87-92
my $mod_suggestion1 = {
Link Here
|
87 |
title => 'my modified title', |
93 |
title => 'my modified title', |
88 |
author => 'my modified author', |
94 |
author => 'my modified author', |
89 |
publishercode => 'my modified publishercode', |
95 |
publishercode => 'my modified publishercode', |
|
|
96 |
managedby => '', |
97 |
manageddate => '', |
90 |
}; |
98 |
}; |
91 |
my $status = ModSuggestion($mod_suggestion1); |
99 |
my $status = ModSuggestion($mod_suggestion1); |
92 |
is( $status, undef, 'ModSuggestion without the suggestion id returns undef' ); |
100 |
is( $status, undef, 'ModSuggestion without the suggestion id returns undef' ); |
Lines 98-103
$suggestion = GetSuggestion($my_suggestionid);
Link Here
|
98 |
is( $suggestion->{title}, $mod_suggestion1->{title}, 'ModSuggestion modifies the title correctly' ); |
106 |
is( $suggestion->{title}, $mod_suggestion1->{title}, 'ModSuggestion modifies the title correctly' ); |
99 |
is( $suggestion->{author}, $mod_suggestion1->{author}, 'ModSuggestion modifies the author correctly' ); |
107 |
is( $suggestion->{author}, $mod_suggestion1->{author}, 'ModSuggestion modifies the author correctly' ); |
100 |
is( $suggestion->{publishercode}, $mod_suggestion1->{publishercode}, 'ModSuggestion modifies the publishercode correctly' ); |
108 |
is( $suggestion->{publishercode}, $mod_suggestion1->{publishercode}, 'ModSuggestion modifies the publishercode correctly' ); |
|
|
109 |
is( $suggestion->{managedby}, undef, 'ModSuggestion stores empty string as undef for non existent foreign key (integer)' ); |
110 |
is( $suggestion->{manageddate}, undef, 'ModSuggestion stores empty string as undef for date' ); |
111 |
isnt( $suggestion->{accepteddate}, undef, 'ModSuggestion does not update a non given date value' ); |
112 |
is( $suggestion->{note}, 'my note', 'ModSuggestion should not erase data if not given' ); |
113 |
|
101 |
my $messages = C4::Letters::GetQueuedMessages({ |
114 |
my $messages = C4::Letters::GetQueuedMessages({ |
102 |
borrowernumber => $borrowernumber, |
115 |
borrowernumber => $borrowernumber, |
103 |
}); |
116 |
}); |
104 |
- |
|
|