From ec31664514f2312a292a4abc77b923b746e962b8 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Fri, 18 Aug 2023 13:11:45 +0200 Subject: [PATCH] Bug 32942: (QA follow-up) Add tests for STATUS checking in Suggestion::store --- t/db_dependent/Koha/Suggestions.t | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Suggestions.t b/t/db_dependent/Koha/Suggestions.t index ae95ebe274..1e987acbc2 100755 --- a/t/db_dependent/Koha/Suggestions.t +++ b/t/db_dependent/Koha/Suggestions.t @@ -49,7 +49,7 @@ my $new_suggestion_2 = Koha::Suggestion->new( )->store; subtest 'store' => sub { - plan tests => 3; + plan tests => 5; my $suggestion = Koha::Suggestion->new( { suggestedby => $patron->{borrowernumber}, biblionumber => $biblio_1->biblionumber, @@ -65,6 +65,18 @@ subtest 'store' => sub { $suggestion->reason('because!')->store; $suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggestion id modified, suggesteddate should not be modified' ); + + throws_ok { + $suggestion->STATUS('UNKNOWN')->store; + } + 'Koha::Exceptions::Suggestion::StatusForbidden', + 'store raises an exception on invalid STATUS'; + + + my $authorised_value = Koha::AuthorisedValue->new({category => 'SUGGEST_STATUS', + authorised_value => 'UNKNOWN'})->store; + $suggestion->STATUS('UNKNOWN')->store; + is($suggestion->STATUS,'UNKNOWN',"UNKNOWN status stored"); $suggestion->delete; }; -- 2.40.1