3 # This Koha test module is a stub!
4 # Add more tests here!!!
12 use Test::More tests => 13;
15 use_ok('C4::Suggestions');
19 my ($suggestionid, $suggestion, $status, $biblionumber);
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");
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 $itemtypes1 = C4::Koha::GetSupportList();
33 ok(scalar @$itemtypes1, "Purchase suggestion itemtypes collected, multiple AdvancedSearchTypes");
35 C4::Context->set_preference("AdvancedSearchTypes", 'itemtypes');
36 my $itemtypes2 = C4::Koha::GetSupportList();
37 ok(scalar @$itemtypes2, "Purchase suggestion itemtypes collected, default AdvancedSearchTypes");
39 is_deeply($itemtypes1, $itemtypes2, 'same set of purchase suggestion formats retrieved');