|
Lines 18-24
Link Here
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::NoWarnings; |
20 |
use Test::NoWarnings; |
| 21 |
use Test::More tests => 13; |
21 |
use Test::More tests => 14; |
| 22 |
use Test::MockObject; |
22 |
use Test::MockObject; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
|
24 |
|
|
Lines 427-429
subtest 'Passing parameters when throwing exception' => sub {
Link Here
|
| 427 |
like( $desc, qr/type => ARRAY/, 'Found type' ); |
427 |
like( $desc, qr/type => ARRAY/, 'Found type' ); |
| 428 |
like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' ); |
428 |
like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' ); |
| 429 |
}; |
429 |
}; |
| 430 |
- |
430 |
|
|
|
431 |
subtest 'full_message() should provide all the details' => sub { |
| 432 |
plan tests => 6; |
| 433 |
|
| 434 |
use Koha::Exceptions::Object; |
| 435 |
|
| 436 |
throws_ok { |
| 437 |
Koha::Exceptions::Object::DuplicateID->throw( |
| 438 |
duplicate_id => 'test_id', |
| 439 |
message => 'the message', |
| 440 |
); |
| 441 |
} |
| 442 |
'Koha::Exceptions::Object::DuplicateID'; |
| 443 |
|
| 444 |
like( $@->full_message, qr/the message/, 'Found the message' ); |
| 445 |
unlike( $@->full_message, qr/test_id/, 'The message hides the original details' ); |
| 446 |
|
| 447 |
throws_ok { |
| 448 |
Koha::Exceptions::Object::DuplicateID->throw( |
| 449 |
duplicate_id => 'test_id', |
| 450 |
); |
| 451 |
} |
| 452 |
'Koha::Exceptions::Object::DuplicateID'; |
| 453 |
|
| 454 |
like( $@->full_message, qr/DuplicateID/, 'Found exception type' ); |
| 455 |
like( $@->full_message, qr/test_id/, 'The message hides the original details' ); |
| 456 |
}; |