|
Lines 22-28
use Test::Exception;
Link Here
|
| 22 |
|
22 |
|
| 23 |
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub { |
23 |
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub { |
| 24 |
|
24 |
|
| 25 |
plan tests => 5; |
25 |
plan tests => 9; |
| 26 |
|
26 |
|
| 27 |
use_ok('Koha::Exceptions::Object'); |
27 |
use_ok('Koha::Exceptions::Object'); |
| 28 |
|
28 |
|
|
Lines 39-44
subtest 'Koha::Exceptions::Object::FKConstraint tests' => sub {
Link Here
|
| 39 |
'Koha::Exceptions::Object::FKConstraint', |
39 |
'Koha::Exceptions::Object::FKConstraint', |
| 40 |
'Exception is thrown :-D'; |
40 |
'Exception is thrown :-D'; |
| 41 |
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' ); |
41 |
is( "$@", 'Manual message exception', 'Exception not stringified if manually passed' ); |
|
|
42 |
|
| 43 |
throws_ok { |
| 44 |
Koha::Exceptions::Object::BadValue->throw( |
| 45 |
type => 'datetime', |
| 46 |
property => 'a_property', |
| 47 |
value => 'a_value' |
| 48 |
); |
| 49 |
} |
| 50 |
'Koha::Exceptions::Object::BadValue', |
| 51 |
'Koha::Exceptions::Object::BadValue exception is thrown :-D'; |
| 52 |
|
| 53 |
# stringify the exception |
| 54 |
is( "$@", 'Invalid value passed, a_property=a_value expected type is datetime', 'Koha::Exceptions::Object::BadValue stringified correctly' ); |
| 55 |
|
| 56 |
throws_ok |
| 57 |
{ Koha::Exceptions::Object::BadValue->throw( "Manual message exception" ) } |
| 58 |
'Koha::Exceptions::Object::BadValue', |
| 59 |
'Koha::Exceptions::Object::BadValue is thrown :-D'; |
| 60 |
is( "$@", 'Manual message exception', 'Koha::Exceptions::Object::BadValue not stringified if manually passed' ); |
| 42 |
}; |
61 |
}; |
| 43 |
|
62 |
|
| 44 |
subtest 'Koha::Exceptions::Password tests' => sub { |
63 |
subtest 'Koha::Exceptions::Password tests' => sub { |
| 45 |
- |
|
|