Bug 22778: Add unit test
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
94ed64e5b1
commit
f5447b33de
1 changed files with 34 additions and 1 deletions
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use DateTime::Duration;
|
||||
use Test::More tests => 113;
|
||||
use Test::More tests => 114;
|
||||
use Test::Warn;
|
||||
|
||||
use t::lib::Mocks;
|
||||
|
@ -145,6 +145,19 @@ my $my_suggestion_with_budget2 = {
|
|||
note => 'my note',
|
||||
budgetid => $budget_id,
|
||||
};
|
||||
my $my_suggestion_without_suggestedby = {
|
||||
title => 'my title',
|
||||
author => 'my author',
|
||||
publishercode => 'my publishercode',
|
||||
suggestedby => undef,
|
||||
biblionumber => $biblio_1->biblionumber,
|
||||
branchcode => 'CPL',
|
||||
managedby => '',
|
||||
manageddate => '',
|
||||
accepteddate => dt_from_string,
|
||||
note => 'my note',
|
||||
quantity => '', # Insert an empty string into int to catch strict SQL modes errors
|
||||
};
|
||||
|
||||
is( CountSuggestion(), 0, 'CountSuggestion without the status returns 0' );
|
||||
is( CountSuggestion('ASKED'), 0, 'CountSuggestion returns the correct number of suggestions' );
|
||||
|
@ -627,4 +640,24 @@ subtest 'EmailPurchaseSuggestions' => sub {
|
|||
'suggestions@b.c', 'EmailAddressForSuggestions uses EmailAddressForSuggestions when set' );
|
||||
};
|
||||
|
||||
subtest 'ModSuggestion should work on suggestions without a suggester' => sub {
|
||||
plan tests => 2;
|
||||
|
||||
$dbh->do(q|DELETE FROM suggestions|);
|
||||
my $my_suggestionid = NewSuggestion($my_suggestion_without_suggestedby);
|
||||
$suggestion = GetSuggestion($my_suggestionid);
|
||||
is( $suggestion->{suggestedby}, undef, "Suggestedby is undef" );
|
||||
|
||||
ModSuggestion(
|
||||
{
|
||||
suggestionid => $my_suggestionid,
|
||||
STATUS => 'CHECKED',
|
||||
note => "Test note"
|
||||
}
|
||||
);
|
||||
$suggestion = GetSuggestion($my_suggestionid);
|
||||
|
||||
is( $suggestion->{note}, "Test note", "ModSuggestion works on suggestions without a suggester" );
|
||||
};
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
|
|
Loading…
Reference in a new issue