From 20cd475fcf53b13bad87367b5b9d007c3e58ec06 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 30 Jan 2024 07:45:13 +0000 Subject: [PATCH] Bug 35248: Add test for Koha::Exceptions::Booking --- t/Koha/Exceptions.t | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/t/Koha/Exceptions.t b/t/Koha/Exceptions.t index 748a0f8084a..9a6ce3ab37f 100755 --- a/t/Koha/Exceptions.t +++ b/t/Koha/Exceptions.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 11; +use Test::More tests => 12; use Test::MockObject; use Test::Exception; @@ -337,6 +337,21 @@ subtest 'Koha::Exceptions::Plugin tests' => sub { is( "$@", "Calling 'upgrade' died for plugin $plugin_class", 'Exception stringified correctly' ); }; +subtest 'Koha::Exceptions::Booking tests' => sub { + + plan tests => 3; + + use_ok('Koha::Exceptions::Booking'); + + throws_ok { Koha::Exceptions::Booking::Clash->throw() } + 'Koha::Exceptions::Booking::Clash', + 'Exception is thrown :-D'; + + # stringify the exception + is( "$@", '[Adding or updating the booking would result in a clash]', 'Exception stringified correctly' ); + # FIXME: I don't understand why the stringified message here gets wrapped in square brackets... +}; + subtest 'Koha::Exception tests' => sub { plan tests => 8; -- 2.43.0