Bugzilla – Attachment 119040 Details for
Bug 27857
Koha::Patron->extended_attributes skips checks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27857: (follow-up) Use a more fine-grained exception for mandatory attributes
Bug-27857-follow-up-Use-a-more-fine-grained-except.patch (text/plain), 2.16 KB, created by
Tomás Cohen Arazi
on 2021-03-31 11:17:26 UTC
(
hide
)
Description:
Bug 27857: (follow-up) Use a more fine-grained exception for mandatory attributes
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2021-03-31 11:17:26 UTC
Size:
2.16 KB
patch
obsolete
>From 766ee7dedb09220db14ddcbffef797f83c590624 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 30 Mar 2021 11:03:09 -0300 >Subject: [PATCH] Bug 27857: (follow-up) Use a more fine-grained exception for > mandatory attributes > >On using this dev for the API, I found that the original FKConstraint >exception was too generic, and could be confused with those risen by >Koha::Patron->store. So this patch changes the exception that is thrown >in Koha::Patron->extended_attributes > >The change is reflected on the test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Patron.t >=> SUCCESS: Tests pass, and they include the new exception >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Patron.pm | 5 ++--- > t/db_dependent/Koha/Patron.t | 2 +- > 2 files changed, 3 insertions(+), 4 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index be83c399cea..7630ce72a56 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1578,9 +1578,8 @@ sub extended_attributes { > { join => 'borrower_attribute_types_branches' } > )->get_column('code'); > for my $type ( @required_attribute_types ) { >- Koha::Exceptions::Object::FKConstraint->throw( >- broken_fk => "$type", >- value => "$type", >+ Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute->throw( >+ type => $type, > ) if !$new_types->{$type}; > } > } >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index bf211af98eb..a645eb37d94 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -644,7 +644,7 @@ subtest 'extended_attributes' => sub { > ] > ); > } >- 'Koha::Exceptions::Object::FKConstraint', >+ 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute', > 'Exception thrown on missing mandatory attribute type'; > > is( $@->value, $attribute_type_1->code, 'Exception parameters are correct' ); >-- >2.31.1
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 27857
:
117709
|
117710
|
117711
|
117938
|
117945
|
117946
|
117947
|
117948
|
117953
|
117954
|
117955
|
117956
|
117957
|
119009
|
119038
| 119040 |
119443
|
119937
|
119938