From 672e8a9d715d144812329aeb07cea5c915c50377 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 Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Suggestions.t | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Suggestions.t b/t/db_dependent/Koha/Suggestions.t index ae95ebe274..7c2e443458 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,21 @@ 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.20.1