Bugzilla – Attachment 119038 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: Get the right column
Bug-27857-Get-the-right-column.patch (text/plain), 2.89 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-03-31 11:06:43 UTC
(
hide
)
Description:
Bug 27857: Get the right column
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-03-31 11:06:43 UTC
Size:
2.89 KB
patch
obsolete
>From 3d25b3646b4973494538947ff64f6db3a97bcd60 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 19 Mar 2021 07:56:39 -0300 >Subject: [PATCH] Bug 27857: Get the right column > >This patch makes the search for mandatory attribute types actually use >'code' instead of 'class' for comparisson. > >Tests are added to cover this behavior. > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/Koha/Patron.t >=> SUCCESS: Tests pass! >3. Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >https://bugs.koha-community.org/show_bug.cgi?id=27587 >--- > Koha/Patron.pm | 2 +- > t/db_dependent/Koha/Patron.t | 16 +++++++++++++--- > 2 files changed, 14 insertions(+), 4 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index 1160084ca63..be83c399cea 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -1576,7 +1576,7 @@ sub extended_attributes { > undef > }, > { join => 'borrower_attribute_types_branches' } >- )->get_column('class'); >+ )->get_column('code'); > for my $type ( @required_attribute_types ) { > Koha::Exceptions::Object::FKConstraint->throw( > broken_fk => "$type", >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 98b079f4c33..bf211af98eb 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -616,21 +616,21 @@ subtest 'extended_attributes' => sub { > > subtest 'globally mandatory attributes tests' => sub { > >- plan tests => 3; >+ plan tests => 5; > > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > > my $attribute_type_1 = $builder->build_object( > { > class => 'Koha::Patron::Attribute::Types', >- value => { mandatory => 1 } >+ value => { mandatory => 1, class => 'a' } > } > ); > > my $attribute_type_2 = $builder->build_object( > { > class => 'Koha::Patron::Attribute::Types', >- value => { mandatory => 0 } >+ value => { mandatory => 0, class => 'a' } > } > ); > >@@ -647,7 +647,17 @@ subtest 'extended_attributes' => sub { > 'Koha::Exceptions::Object::FKConstraint', > 'Exception thrown on missing mandatory attribute type'; > >+ is( $@->value, $attribute_type_1->code, 'Exception parameters are correct' ); >+ > is( $patron->extended_attributes->count, 0, 'Extended attributes storing rolled back' ); >+ >+ $patron->extended_attributes( >+ [ >+ { code => $attribute_type_1->code, attribute => 'b' } >+ ] >+ ); >+ >+ is( $patron->extended_attributes->count, 1, 'Extended attributes succeeded' ); > }; > > $schema->storage->txn_rollback; >-- >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