|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 1; |
20 |
use Test::More tests => 2; |
| 21 |
use Test::Exception; |
21 |
use Test::Exception; |
| 22 |
|
22 |
|
| 23 |
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub { |
23 |
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub { |
|
Lines 41-43
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub {
Link Here
|
| 41 |
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' ); |
41 |
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' ); |
| 42 |
}; |
42 |
}; |
| 43 |
|
43 |
|
| 44 |
- |
44 |
subtest 'Koha::Exceptions::Password tests' => sub { |
|
|
45 |
|
| 46 |
plan tests => 5; |
| 47 |
|
| 48 |
use_ok('Koha::Exceptions::Password'); |
| 49 |
|
| 50 |
throws_ok |
| 51 |
{ Koha::Exceptions::Password::TooShort->throw( length => 4, min_length => 5 ); } |
| 52 |
'Koha::Exceptions::Password::TooShort', |
| 53 |
'Exception is thrown :-D'; |
| 54 |
|
| 55 |
# stringify the exception |
| 56 |
is( "$@", 'Password length (4) is shorter than required (5)', 'Exception stringified correctly' ); |
| 57 |
|
| 58 |
throws_ok |
| 59 |
{ Koha::Exceptions::Password::TooShort->throw( "Manual message exception" ) } |
| 60 |
'Koha::Exceptions::Password::TooShort', |
| 61 |
'Exception is thrown :-D'; |
| 62 |
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' ); |
| 63 |
}; |