Bugzilla – Attachment 57214 Details for
Bug 17494
Koha generating duplicate self registration tokens
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17494: (QA followup) Fix exception name
Bug-17494-QA-followup-Fix-exception-name.patch (text/plain), 3.18 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-11-04 15:32:28 UTC
(
hide
)
Description:
Bug 17494: (QA followup) Fix exception name
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-11-04 15:32:28 UTC
Size:
3.18 KB
patch
obsolete
>From 8564568e6f15963689903b2a9b9578307ef883a8 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 4 Nov 2016 12:18:57 -0300 >Subject: [PATCH] Bug 17494: (QA followup) Fix exception name > >This patch changes the exception name to match the package name. And >also adds a test for the thrown exception message. > >Also creates a general Koha::Exception::Patron::Modification exception >to make the new one inherit from it, following the common use in the codebase. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Exceptions/Patron/Modification.pm | 10 +++++++--- > Koha/Patron/Modification.pm | 4 +++- > t/db_dependent/Koha_borrower_modifications.t | 5 +++-- > 3 files changed, 13 insertions(+), 6 deletions(-) > >diff --git a/Koha/Exceptions/Patron/Modification.pm b/Koha/Exceptions/Patron/Modification.pm >index 1068fbb..4cf5cfa 100644 >--- a/Koha/Exceptions/Patron/Modification.pm >+++ b/Koha/Exceptions/Patron/Modification.pm >@@ -3,10 +3,14 @@ package Koha::Exceptions::Patron::Modification; > use Modern::Perl; > > use Exception::Class ( >- 'Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken' => { >- isa => 'Koha::Exceptions::Object', >- description => "The verification token given already exists", >+ >+ 'Koha::Exceptions::Patron::Modification' => { >+ description => 'Something went wrong' > }, >+ 'Koha::Exceptions::Patron::Modification::DuplicateVerificationToken' => { >+ isa => 'Koha::Exceptions::Patron::Modification', >+ description => "The verification token given already exists" >+ } > ); > > 1; >diff --git a/Koha/Patron/Modification.pm b/Koha/Patron/Modification.pm >index 63f124f..d1e033b 100644 >--- a/Koha/Patron/Modification.pm >+++ b/Koha/Patron/Modification.pm >@@ -45,7 +45,9 @@ sub store { > > if ( $self->verification_token ) { > if ( Koha::Patron::Modifications->search( { verification_token => $self->verification_token } )->count() ) { >- Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken->throw; >+ Koha::Exceptions::Patron::Modification::DuplicateVerificationToken->throw( >+ "Duplicate verification token " . $self->verification_token >+ ); > } > } > >diff --git a/t/db_dependent/Koha_borrower_modifications.t b/t/db_dependent/Koha_borrower_modifications.t >index 80eb6e2..0a03821 100755 >--- a/t/db_dependent/Koha_borrower_modifications.t >+++ b/t/db_dependent/Koha_borrower_modifications.t >@@ -1,7 +1,7 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use Test::More tests => 9; >+use Test::More tests => 10; > use Try::Tiny; > > use t::lib::TestBuilder; >@@ -39,8 +39,9 @@ try { > } > )->store(); > } catch { >- ok( $_->isa('Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken'), >+ ok( $_->isa('Koha::Exceptions::Patron::Modification::DuplicateVerificationToken'), > 'Attempting to add a duplicate verification token to the database should raise a Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken exception' ); >+ is( $_->message, "Duplicate verification token 1234567890", 'Exception carries the right message' ); > }; > > ## Get the new pending modification >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17494
:
56914
|
56992
|
56993
|
57008
|
57204
|
57205
|
57206
|
57212
|
57213
| 57214