Bugzilla – Attachment 172784 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), 4.15 KB, created by
Nick Clemens (kidclamp)
on 2024-10-15 15:43:02 UTC
(
hide
)
Description:
Bug 38005: (follow-up) Add/adjust tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-10-15 15:43:02 UTC
Size:
4.15 KB
patch
obsolete
>From 236aac3432d3d15d5e01242e583c4291a1076be5 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 > >NC amended patch, tidied >Bug 38005: (QA follow-up) Tidy > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Koha/Patron.t | 61 +++++++++++++++++++++++++++++------- > 1 file changed, 49 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t >index 970235ecc55..3e19279f76b 100755 >--- a/t/db_dependent/Koha/Patron.t >+++ b/t/db_dependent/Koha/Patron.t >@@ -1024,12 +1024,14 @@ 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 $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $context = Test::MockModule->new('C4::Context'); >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > > my $attribute_type_1 = $builder->build_object( > { >@@ -1045,17 +1047,33 @@ subtest 'extended_attributes' => sub { > } > ); > >- is( $patron->extended_attributes->count, 0, 'Patron has no extended attributes' ); >+ my $attribute_type_3 = $builder->build_object( >+ { >+ class => 'Koha::Patron::Attribute::Types', >+ value => { mandatory => 1, class => 'a', category_code => undef, opac_editable => 1 } >+ } >+ ); > >- throws_ok >+ my $attribute_type_4 = $builder->build_object( > { >- $patron->extended_attributes( >- [ >- { code => $attribute_type_2->code, attribute => 'b' } >- ] >- ); >+ class => 'Koha::Patron::Attribute::Types', >+ value => { mandatory => 0, class => 'a', category_code => undef, opac_editable => 1 } > } >- 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute', >+ ); >+ >+ #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_3->code, attribute => 'b' }, >+ ] >+ ); >+ } >+ 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute', > 'Exception thrown on missing mandatory attribute type'; > > is( $@->type, $attribute_type_1->code, 'Exception parameters are correct' ); >@@ -1064,11 +1082,30 @@ 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.5
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