View | Details | Raw Unified | Return to bug 32334
Collapse All | Expand All

(-)a/Koha/Exceptions.pm (-1 / +2 lines)
Lines 55-61 use Exception::Class ( Link Here
55
    },
55
    },
56
    'Koha::Exceptions::WrongParameter' => {
56
    'Koha::Exceptions::WrongParameter' => {
57
        isa => 'Koha::Exception',
57
        isa => 'Koha::Exception',
58
        description => 'One or more parameters are wrong',
58
        description => 'Parameter has wrong value or type',
59
        fields => ['name', 'value', 'type'],
59
    },
60
    },
60
    'Koha::Exceptions::NoPermission' => {
61
    'Koha::Exceptions::NoPermission' => {
61
        isa => 'Koha::Exception',
62
        isa => 'Koha::Exception',
(-)a/t/Koha/Exceptions.t (-2 / +13 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 10;
20
use Test::More tests => 11;
21
use Test::MockObject;
21
use Test::MockObject;
22
use Test::Exception;
22
use Test::Exception;
23
23
Lines 397-399 subtest 'Koha::Exception tests' => sub { Link Here
397
        'Exception stringified correctly'
397
        'Exception stringified correctly'
398
    );
398
    );
399
};
399
};
400
- 
400
401
subtest 'Passing parameters when throwing exception' => sub {
402
    plan tests => 4;
403
404
    use Koha::Exceptions;
405
406
    throws_ok { Koha::Exceptions::WrongParameter->throw( name => 'wrong1', type => 'ARRAY', value => [ 1, 2 ] ) } qr/Koha::Exceptions::WrongParameter/, 'Exception thrown';
407
    my $desc = $@;
408
    like( $desc, qr/name => wrong1/, 'Found name' );
409
    like( $desc, qr/type => ARRAY/, 'Found type' );
410
    like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' );
411
};

Return to bug 32334