Bug 28056: Unit tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-03-30 10:51:34 -03:00 committed by Jonathan Druart
parent 4f3ad7112f
commit 3ee844ff56
1 changed files with 25 additions and 1 deletions

View File

@ -17,7 +17,7 @@
use Modern::Perl;
use Test::More tests => 7;
use Test::More tests => 8;
use Test::MockObject;
use Test::Exception;
@ -285,3 +285,27 @@ subtest 'Koha::Exceptions::Patron::Attribute::* tests' => sub {
'Exception not stringified if manually passed'
);
};
subtest 'Koha::Exceptions::Patron tests' => sub {
plan tests => 5;
use_ok("Koha::Exceptions::Patron");
my $type = 'yahey';
throws_ok
{ Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw(
type => $type ); }
'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute',
'Exception is thrown :-D';
# stringify the exception
is( "$@", "Missing mandatory extended attribute (type=$type)", 'Exception stringified correctly' );
throws_ok
{ Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw( "Manual message exception" ) }
'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute',
'Exception is thrown :-D';
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' );
};