Bugzilla – Attachment 172702 Details for
Bug 38005
500 error on self registration when patron attribute is set as mandatory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38005: (follow-up) Add/adjust tests
Bug-38005-follow-up-Addadjust-tests.patch (text/plain), 3.52 KB, created by
Lucas Gass (lukeg)
on 2024-10-11 19:20:03 UTC
(
hide
)
Description:
Bug 38005: (follow-up) Add/adjust tests
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-10-11 19:20:03 UTC
Size:
3.52 KB
patch
obsolete
>From ca2ad8068b6a6273e2f47194030e95a9813477b3 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Fri, 11 Oct 2024 19:12:18 +0000 >Subject: [PATCH] Bug 38005: (follow-up) Add/adjust tests > >--- > t/db_dependent/Koha/Patron.t | 47 +++++++++++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 970235ecc55..7b43d274d5c 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -1024,11 +1024,13 @@ subtest 'extended_attributes' => sub { > > subtest 'globally mandatory attributes tests' => sub { > >- plan tests => 5; >+ plan tests => 8; > > $schema->storage->txn_begin; > Koha::Patron::Attribute::Types->search->delete; > >+ my $context = Test::MockModule->new('C4::Context'); >+ > my $patron = $builder->build_object({ class => 'Koha::Patrons' }); > > my $attribute_type_1 = $builder->build_object( >@@ -1045,13 +1047,30 @@ subtest 'extended_attributes' => sub { > } > ); > >+ my $attribute_type_3 = $builder->build_object( >+ { >+ class => 'Koha::Patron::Attribute::Types', >+ value => { mandatory => 1, class => 'a', category_code => undef, opac_editable => 1 } >+ } >+ ); >+ >+ my $attribute_type_4 = $builder->build_object( >+ { >+ class => 'Koha::Patron::Attribute::Types', >+ value => { mandatory => 0, class => 'a', category_code => undef, opac_editable => 1 } >+ } >+ ); >+ >+ #Staff interface tests >+ $context->mock( 'interface', sub { return "intranet" } ); > is( $patron->extended_attributes->count, 0, 'Patron has no extended attributes' ); > > throws_ok > { > $patron->extended_attributes( > [ >- { code => $attribute_type_2->code, attribute => 'b' } >+ { code => $attribute_type_2->code, attribute => 'b' }, >+ { code => $attribute_type_3->code, attribute => 'b' }, > ] > ); > } >@@ -1064,11 +1083,31 @@ subtest 'extended_attributes' => sub { > > $patron->extended_attributes( > [ >- { code => $attribute_type_1->code, attribute => 'b' } >+ { code => $attribute_type_1->code, attribute => 'b' }, >+ { code => $attribute_type_3->code, attribute => 'b' }, > ] > ); > >- is( $patron->extended_attributes->count, 1, 'Extended attributes succeeded' ); >+ is( $patron->extended_attributes->count, 2, 'Extended attributes succeeded' ); >+ >+ # OPAC interface tests >+ $context->mock( 'interface', sub { return "opac" } ); >+ >+ is( $patron->extended_attributes->count, 2, 'Patron still has 2 extended attributes in OPAC' ); >+ >+ throws_ok >+ { >+ $patron->extended_attributes( >+ [ >+ { code => $attribute_type_1->code, attribute => 'b' }, >+ { code => $attribute_type_2->code, attribute => 'b' }, >+ ] >+ ); >+ } >+ 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute', >+ 'Exception thrown on missing mandatory OPAC-editable attribute'; >+ >+ is( $@->type, $attribute_type_3->code, 'Exception parameters are correct for OPAC-editable attribute' ); > > $schema->storage->txn_rollback; > >-- >2.39.2
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 38005
:
171956
|
172501
|
172504
|
172513
|
172702
|
172784