Bug 11466: improve selection of item types for purchase order desired format list
[koha.git] / t / db_dependent / Suggestions.t
1 #!/usr/bin/perl
2 #
3 # This Koha test module is a stub!
4 # Add more tests here!!!
5
6 use strict;
7 use warnings;
8 use Data::Dumper;
9
10 use C4::Suggestions;
11
12 use Test::More tests =>12;
13
14 BEGIN {
15     use_ok('C4::Suggestions');
16     use_ok('C4::Koha');
17 }
18
19 my ($suggestionid, $suggestion, $status, $biblionumber);
20 $biblionumber = 1;
21 ok($suggestionid= NewSuggestion( {title=>'Petit traité de philosohpie',author=>'Hubert de Chardassé',publishercode=>'Albin Michel'} ), "NewSuggestion OK");
22 ok($suggestion= GetSuggestion( $suggestionid), "GetSuggestion OK");
23 ok($status= ModSuggestion( {title=>'test Modif Simple', suggestionid=>$suggestionid} ), "ModSuggestion Simple OK");
24 ok($status= ModSuggestion( {STATUS=>'STALLED', suggestionid=>$suggestionid} ), "ModSuggestion Status OK");
25 ok($status= ModSuggestion( {suggestionid => $suggestionid, biblionumber => $biblionumber } ), "ModSuggestion, set biblionumber OK" );
26 ok($suggestion= GetSuggestionFromBiblionumber( $biblionumber ), "GetSuggestionFromBiblionumber OK");
27 ok($suggestion= GetSuggestionInfoFromBiblionumber( $biblionumber ), "GetSuggestionInfoFromBiblionumber OK");
28 ok(@{SearchSuggestion( {STATUS=>'STALLED'} )}>0, "SearchSuggestion Status OK");
29
30 ## Bug 11466, making sure GetSupportList() returns itemtypes, even if AdvancedSearchTypes has multiple values
31 C4::Context->set_preference("AdvancedSearchTypes", 'itemtypes|loc|ccode');
32 my $itemtypes = C4::Koha::GetSupportList();
33 ok(scalar @$itemtypes, "Purchase suggestion itemtypes collected, multiple AdvancedSearchTypes");
34
35 C4::Context->set_preference("AdvancedSearchTypes", 'itemtypes');
36 $itemtypes = C4::Koha::GetSupportList();
37 ok(scalar @$itemtypes, "Purchase suggestion itemtypes collected, default AdvancedSearchTypes");
38 ##EO Bug 11466