View | Details | Raw Unified | Return to bug 23027
Collapse All | Expand All

(-)a/t/db_dependent/Suggestions.t (-10 / +9 lines)
Lines 91-103 my $member2 = { Link Here
91
my $borrowernumber = Koha::Patron->new($member)->store->borrowernumber;
91
my $borrowernumber = Koha::Patron->new($member)->store->borrowernumber;
92
my $borrowernumber2 = Koha::Patron->new($member2)->store->borrowernumber;
92
my $borrowernumber2 = Koha::Patron->new($member2)->store->borrowernumber;
93
93
94
my $biblionumber1 = 1;
94
my $biblio_1 = $builder->build_object({ class => 'Koha::Biblios' });
95
my $my_suggestion = {
95
my $my_suggestion = {
96
    title         => 'my title',
96
    title         => 'my title',
97
    author        => 'my author',
97
    author        => 'my author',
98
    publishercode => 'my publishercode',
98
    publishercode => 'my publishercode',
99
    suggestedby   => $borrowernumber,
99
    suggestedby   => $borrowernumber,
100
    biblionumber  => $biblionumber1,
100
    biblionumber  => $biblio_1->biblionumber,
101
    branchcode    => 'CPL',
101
    branchcode    => 'CPL',
102
    managedby     => '',
102
    managedby     => '',
103
    manageddate   => '',
103
    manageddate   => '',
Lines 125-131 my $my_suggestion_with_budget = { Link Here
125
    author        => 'my author 2',
125
    author        => 'my author 2',
126
    publishercode => 'my publishercode 2',
126
    publishercode => 'my publishercode 2',
127
    suggestedby   => $borrowernumber,
127
    suggestedby   => $borrowernumber,
128
    biblionumber  => $biblionumber1,
128
    biblionumber  => $biblio_1->biblionumber,
129
    managedby     => '',
129
    managedby     => '',
130
    manageddate   => '',
130
    manageddate   => '',
131
    accepteddate  => dt_from_string,
131
    accepteddate  => dt_from_string,
Lines 137-143 my $my_suggestion_with_budget2 = { Link Here
137
    author        => 'my author 3',
137
    author        => 'my author 3',
138
    publishercode => 'my publishercode 3',
138
    publishercode => 'my publishercode 3',
139
    suggestedby   => $borrowernumber2,
139
    suggestedby   => $borrowernumber2,
140
    biblionumber  => $biblionumber1,
140
    biblionumber  => $biblio_1->biblionumber,
141
    managedby     => '',
141
    managedby     => '',
142
    manageddate   => '',
142
    manageddate   => '',
143
    accepteddate  => dt_from_string,
143
    accepteddate  => dt_from_string,
Lines 273-284 is( $suggestion->{borrnumsuggestedby}, $my_suggestion->{suggestedby}, 'GetSugges Link Here
273
273
274
is( GetSuggestionFromBiblionumber(), undef, 'GetSuggestionFromBiblionumber without the biblio number returns undef' );
274
is( GetSuggestionFromBiblionumber(), undef, 'GetSuggestionFromBiblionumber without the biblio number returns undef' );
275
is( GetSuggestionFromBiblionumber(2), undef, 'GetSuggestionFromBiblionumber with an invalid biblio number returns undef' );
275
is( GetSuggestionFromBiblionumber(2), undef, 'GetSuggestionFromBiblionumber with an invalid biblio number returns undef' );
276
is( GetSuggestionFromBiblionumber($biblionumber1), $my_suggestionid, 'GetSuggestionFromBiblionumber functions correctly' );
276
is( GetSuggestionFromBiblionumber($biblio_1->biblionumber), $my_suggestionid, 'GetSuggestionFromBiblionumber functions correctly' );
277
277
278
278
279
is( GetSuggestionInfoFromBiblionumber(), undef, 'GetSuggestionInfoFromBiblionumber without the biblio number returns undef' );
279
is( GetSuggestionInfoFromBiblionumber(), undef, 'GetSuggestionInfoFromBiblionumber without the biblio number returns undef' );
280
is( GetSuggestionInfoFromBiblionumber(2), undef, 'GetSuggestionInfoFromBiblionumber with an invalid biblio number returns undef' );
280
is( GetSuggestionInfoFromBiblionumber(2), undef, 'GetSuggestionInfoFromBiblionumber with an invalid biblio number returns undef' );
281
$suggestion = GetSuggestionInfoFromBiblionumber($biblionumber1);
281
$suggestion = GetSuggestionInfoFromBiblionumber($biblio_1->biblionumber);
282
is( $suggestion->{suggestionid}, $my_suggestionid, 'GetSuggestionInfoFromBiblionumber returns the suggestion id correctly' );
282
is( $suggestion->{suggestionid}, $my_suggestionid, 'GetSuggestionInfoFromBiblionumber returns the suggestion id correctly' );
283
is( $suggestion->{title}, $mod_suggestion1->{title}, 'GetSuggestionInfoFromBiblionumber returns the title correctly' );
283
is( $suggestion->{title}, $mod_suggestion1->{title}, 'GetSuggestionInfoFromBiblionumber returns the title correctly' );
284
is( $suggestion->{author}, $mod_suggestion1->{author}, 'GetSuggestionInfoFromBiblionumber returns the author correctly' );
284
is( $suggestion->{author}, $mod_suggestion1->{author}, 'GetSuggestionInfoFromBiblionumber returns the author correctly' );
Lines 310-320 is( $suggestions->[0]->{categorycodesuggestedby}, $member->{categorycode}, 'GetS Link Here
310
310
311
311
312
is( ConnectSuggestionAndBiblio(), '0E0', 'ConnectSuggestionAndBiblio without arguments returns 0E0' );
312
is( ConnectSuggestionAndBiblio(), '0E0', 'ConnectSuggestionAndBiblio without arguments returns 0E0' );
313
my $biblionumber2 = 2;
313
my $biblio_2 = $builder->build_object({ class => 'Koha::Biblios' });
314
my $connect_suggestion_and_biblio = ConnectSuggestionAndBiblio($my_suggestionid, $biblionumber2);
314
my $connect_suggestion_and_biblio = ConnectSuggestionAndBiblio($my_suggestionid, $biblio_2->biblionumber);
315
is( $connect_suggestion_and_biblio, '1', 'ConnectSuggestionAndBiblio returns 1' );
315
is( $connect_suggestion_and_biblio, '1', 'ConnectSuggestionAndBiblio returns 1' );
316
$suggestion = GetSuggestion($my_suggestionid);
316
$suggestion = GetSuggestion($my_suggestionid);
317
is( $suggestion->{biblionumber}, $biblionumber2, 'ConnectSuggestionAndBiblio updates the biblio number correctly' );
317
is( $suggestion->{biblionumber}, $biblio_2->biblionumber, 'ConnectSuggestionAndBiblio updates the biblio number correctly' );
318
318
319
my $search_suggestion = SearchSuggestion();
319
my $search_suggestion = SearchSuggestion();
320
is( @$search_suggestion, 3, 'SearchSuggestion without arguments returns all suggestions' );
320
is( @$search_suggestion, 3, 'SearchSuggestion without arguments returns all suggestions' );
321
- 

Return to bug 23027