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

(-)a/Koha/Exceptions/Patron/Modification.pm (-3 / +7 lines)
Lines 3-12 package Koha::Exceptions::Patron::Modification; Link Here
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Exception::Class (
5
use Exception::Class (
6
    'Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken' => {
6
7
        isa => 'Koha::Exceptions::Object',
7
    'Koha::Exceptions::Patron::Modification' => {
8
        description => "The verification token given already exists",
8
        description => 'Something went wrong'
9
    },
9
    },
10
    'Koha::Exceptions::Patron::Modification::DuplicateVerificationToken' => {
11
        isa => 'Koha::Exceptions::Patron::Modification',
12
        description => "The verification token given already exists"
13
    }
10
);
14
);
11
15
12
1;
16
1;
(-)a/Koha/Patron/Modification.pm (-1 / +3 lines)
Lines 45-51 sub store { Link Here
45
45
46
    if ( $self->verification_token ) {
46
    if ( $self->verification_token ) {
47
        if ( Koha::Patron::Modifications->search( { verification_token => $self->verification_token } )->count() ) {
47
        if ( Koha::Patron::Modifications->search( { verification_token => $self->verification_token } )->count() ) {
48
            Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken->throw;
48
            Koha::Exceptions::Patron::Modification::DuplicateVerificationToken->throw(
49
                "Duplicate verification token " . $self->verification_token
50
            );
49
        }
51
        }
50
    }
52
    }
51
53
(-)a/t/db_dependent/Koha_borrower_modifications.t (-3 / +3 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 9;
4
use Test::More tests => 10;
5
use Try::Tiny;
5
use Try::Tiny;
6
6
7
use t::lib::TestBuilder;
7
use t::lib::TestBuilder;
Lines 39-46 try { Link Here
39
        }
39
        }
40
    )->store();
40
    )->store();
41
} catch {
41
} catch {
42
    ok( $_->isa('Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken'),
42
    ok( $_->isa('Koha::Exceptions::Patron::Modification::DuplicateVerificationToken'),
43
        'Attempting to add a duplicate verification token to the database should raise a Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken exception' );
43
        'Attempting to add a duplicate verification token to the database should raise a Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken exception' );
44
    is( $_->message, "Duplicate verification token 1234567890", 'Exception carries the right message' );
44
};
45
};
45
46
46
## Get the new pending modification
47
## Get the new pending modification
47
- 

Return to bug 17494