Lines 111-128
subtest 'Koha::Exceptions::Metadata tests' => sub {
Link Here
|
111 |
|
111 |
|
112 |
my $object = Test::MockObject->new; |
112 |
my $object = Test::MockObject->new; |
113 |
$object->mock( 'id', 'an_id' ); |
113 |
$object->mock( 'id', 'an_id' ); |
|
|
114 |
$object->mock( 'biblionumber', 'a_biblionumber' ); |
114 |
$object->mock( 'format', 'a_format' ); |
115 |
$object->mock( 'format', 'a_format' ); |
115 |
$object->mock( 'schema', 'a_schema' ); |
116 |
$object->mock( 'schema', 'a_schema' ); |
116 |
|
117 |
|
117 |
throws_ok |
118 |
throws_ok |
118 |
{ Koha::Exceptions::Metadata::Invalid->throw( |
119 |
{ Koha::Exceptions::Metadata::Invalid->throw( |
119 |
id => 'an_id', format => 'a_format', |
120 |
id => 'an_id', biblionumber => 'a_biblionumber', format => 'a_format', |
120 |
schema => 'a_schema', decoding_error => 'a_nasty_error' ); } |
121 |
schema => 'a_schema', decoding_error => 'a_nasty_error' ); } |
121 |
'Koha::Exceptions::Metadata::Invalid', |
122 |
'Koha::Exceptions::Metadata::Invalid', |
122 |
'Exception is thrown :-D'; |
123 |
'Exception is thrown :-D'; |
123 |
|
124 |
|
124 |
# stringify the exception |
125 |
# stringify the exception |
125 |
is( "$@", 'Invalid data, cannot decode object (id=an_id, format=a_format, schema=a_schema, decoding_error=\'a_nasty_error\')', 'Exception stringified correctly' ); |
126 |
is( "$@", 'Invalid data, cannot decode object (id=an_id, biblionumber=a_biblionumber, format=a_format, schema=a_schema, decoding_error=\'a_nasty_error\')', 'Exception stringified correctly' ); |
126 |
|
127 |
|
127 |
throws_ok |
128 |
throws_ok |
128 |
{ Koha::Exceptions::Metadata::Invalid->throw( "Manual message exception" ) } |
129 |
{ Koha::Exceptions::Metadata::Invalid->throw( "Manual message exception" ) } |
129 |
- |
|
|