Bugzilla – Attachment 131254 Details for
Bug 29005
Add option to send WELCOME notice for new patrons added via patron imports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29005: Unit tests
Bug-29005-Unit-tests.patch (text/plain), 2.48 KB, created by
Martin Renvoize (ashimema)
on 2022-03-02 14:24:18 UTC
(
hide
)
Description:
Bug 29005: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-03-02 14:24:18 UTC
Size:
2.48 KB
patch
obsolete
>From 774828c5365c31162e2acc50b8e36d1a43246ff4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 2 Mar 2022 14:18:55 +0000 >Subject: [PATCH] Bug 29005: Unit tests > >Add a unit test for the additional functionality of sending welcome >emails from Koha::Patrons::Import. >--- > t/db_dependent/Koha/Patrons/Import.t | 28 +++++++++++++++++++++++++++- > 1 file changed, 27 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t >index 0d1eb8ff1e..bf16c1e118 100755 >--- a/t/db_dependent/Koha/Patrons/Import.t >+++ b/t/db_dependent/Koha/Patrons/Import.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 173; >+use Test::More tests => 174; > use Test::Warn; > use Test::Exception; > use Encode qw( encode_utf8 ); >@@ -1143,6 +1143,32 @@ subtest 'patron_attributes' => sub { > > }; > >+subtest 'welcome_email' => sub { >+ >+ plan tests => 3; >+ >+ #Setup our info >+ my $branchcode = $builder->build({ source => "Branch"})->{branchcode}; >+ my $categorycode = $builder->build({ source => "Category", value => { category_type => 'A' } })->{categorycode}; >+ my $staff_categorycode = $builder->build({ source => "Category", value => { category_type => 'S' } })->{categorycode}; >+ my $csv_headers = 'surname,userid,branchcode,categorycode,password,email'; >+ my $csv_new = "Spagobi,EldridgeS,$branchcode,$categorycode,H4ckR".',me@myemail.com'; >+ my $defaults = { cardnumber => "" }; #currently all the defaults come as "" if not filled >+ >+ #Make the test files for importing >+ my $filename_1 = make_csv($temp_dir, $csv_headers, $csv_new); >+ open(my $handle_1, "<", $filename_1) or die "cannot open < $filename_1: $!"; >+ >+ my $params_1 = { file => $handle_1, matchpoint => 'userid', overwrite_passwords => 1, overwrite_cardnumber => 1, send_welcome => 1}; >+ >+ my $result = $patrons_import->import_patrons($params_1, $defaults); >+ is($result->{already_in_db}, 0, 'New borrower imported as expected'); >+ is($result->{feedback}->[3]->{name}, 'welcome_sent', 'Email send reported'); >+ my $eldridge = Koha::Patrons->find({ userid => 'EldridgeS'}); >+ my $notices = Koha::Notice::Messages->search({ borrowernumber => $eldridge->borrowernumber }); >+ is($notices->count, 1, 'Notice was queued'); >+}; >+ > # got is { code => $code, attribute => $attribute } > # expected is { $code => \@attributes } > sub compare_patron_attributes { >-- >2.20.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 29005
:
125598
|
126039
|
126040
|
131246
|
131247
|
131248
|
131249
|
131250
|
131251
|
131252
|
131253
|
131254
|
132782
|
132783
|
132784
|
132909
|
132910