Bugzilla – Attachment 190492 Details for
Bug 40219
Welcome Email Sent on Failed Patron Registration via API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40219: Add unit test to verify welcome email is not sent on validation failure
63fe38c.patch (text/plain), 2.63 KB, created by
Martin Renvoize (ashimema)
on 2025-12-15 10:34:40 UTC
(
hide
)
Description:
Bug 40219: Add unit test to verify welcome email is not sent on validation failure
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-12-15 10:34:40 UTC
Size:
2.63 KB
patch
obsolete
>From 63fe38c244824323de740b8ef38726781a6d8e6e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Mon, 15 Dec 2025 10:32:38 +0000 >Subject: [PATCH] Bug 40219: Add unit test to verify welcome email is not sent > on validation failure > >This test ensures that when extended attribute validation fails during >patron creation via the API, no welcome email is sent. This validates >the fix where extended_attributes() validation was moved before the >welcome email is enqueued. > >Test plan: >1. Apply this patch >2. Run: prove t/db_dependent/api/v1/patrons.t >3. Verify all tests pass, including the new test that confirms no welcome > email is sent when extended attribute validation fails > >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/db_dependent/api/v1/patrons.t | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t >index 82e579af404..6673030c371 100755 >--- a/t/db_dependent/api/v1/patrons.t >+++ b/t/db_dependent/api/v1/patrons.t >@@ -586,7 +586,7 @@ subtest 'add() tests' => sub { > > subtest 'extended_attributes handling tests' => sub { > >- plan tests => 25; >+ plan tests => 29; > > $mocked_patron->mock( > 'extended_attributes', >@@ -622,6 +622,23 @@ subtest 'add() tests' => sub { > > is( Koha::Patrons->search->count, $patrons_count, 'No patron added' ); > >+ # Bug 40219: Test that welcome email is not sent when extended attribute validation fails >+ t::lib::Mocks::mock_preference( 'AutoEmailNewUser', 1 ); >+ $letter_enqueued = 0; >+ $extended_attrs_exception = 'Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute'; >+ $t->post_ok( >+ "//$userid:$password\@/api/v1/patrons" => json => { >+ "firstname" => "Bug", >+ "surname" => "FortyZeroTwoOneNine", >+ "address" => "Somewhere", >+ "category_id" => "ST", >+ "city" => "TestCity", >+ "library_id" => "MPL", >+ "email" => 'bug40219@test.com' >+ } >+ )->status_is(400)->json_is( '/error' => "Missing mandatory extended attribute (type=$type)" ); >+ is( $letter_enqueued, 0, 'Bug 40219: No welcome email sent when extended attribute validation fails' ); >+ > $extended_attrs_exception = 'Koha::Exceptions::Patron::Attribute::InvalidType'; > $t->post_ok( > "//$userid:$password@/api/v1/patrons" => json => { >-- >2.52.0 >
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 40219
:
183421
|
184171
|
190491
| 190492