Bug 35248: Add test for Koha::Exceptions::Booking

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-01-30 07:45:13 +00:00 committed by Katrin Fischer
parent 6b8c52104c
commit 8e370de1d9
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 16 additions and 1 deletions

View File

@ -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;