Bugzilla – Attachment 90415 Details for
Bug 23077
Can't import patrons without cardnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23077 - Unit tests
Bug-23077---Unit-tests.patch (text/plain), 2.43 KB, created by
Nick Clemens (kidclamp)
on 2019-06-07 12:22:26 UTC
(
hide
)
Description:
Bug 23077 - Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-06-07 12:22:26 UTC
Size:
2.43 KB
patch
obsolete
>From 98e3e5d46c2ceaa0c8269c926def50c2783c18e8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 7 Jun 2019 12:18:55 +0000 >Subject: [PATCH] Bug 23077 - Unit tests > >prove -v t/db_dependent/Koha/Patrons/Import.t >--- > t/db_dependent/Koha/Patrons/Import.t | 30 +++++++++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t >index 5d33bd3d16..78470cdcdc 100644 >--- 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 => 155; >+use Test::More tests => 156; > use Test::Warn; > > # To be replaced by t::lib::Mock >@@ -376,6 +376,34 @@ is($result_7->{imported}, 1, 'Got the expected 1 imported result from import pat > is($result_7->{invalid}, 1, 'Got the expected 1 invalid result from import patrons for dates tests'); > is($result_7->{overwritten}, 0, 'Got the expected 0 overwritten result from import patrons for dates tests'); > >+subtest 'test_import_without_cardnumber' => sub { >+ plan tests => 2; >+ >+ #Remove possible existing user with a "" as cardnumber >+ my $blank_card = Koha::Patrons->find({ cardnumber => '' }); >+ $blank_card->delete if $blank_card; >+ >+ my $branchcode = $builder->build({ source => "Branch"})->{branchcode}; >+ my $categorycode = $builder->build({ source => "Category"})->{categorycode}; >+ my $csv_headers = 'surname, branchcode, categorycode'; >+ my $res_headers = 'surname, branchcode, categorycode'; >+ my $csv_nocard_1 = "Squarepants,$branchcode,$categorycode"; >+ my $csv_nocard_2 = "Star,$branchcode,$categorycode"; >+ >+ my $filename_1 = make_csv($temp_dir, $csv_headers, $csv_nocard_1, $csv_nocard_2); >+ open(my $handle_1, "<", $filename_1) or die "cannot open < $filename_1: $!"; >+ my $params_1 = { file => $handle_1, }; >+ >+ my $defaults = { cardnumber => "" }; #currently all the defaults come as "" if not filled >+ >+ my $result = $patrons_import->import_patrons($params_1, $defaults); >+ warn Data::Dumper::Dumper( $result ); >+ like($result->{feedback}->[1]->{value}, qr/^Squarepants \/ \d+/, 'First borrower imported as expected'); >+ like($result->{feedback}->[2]->{value}, qr/^Star \/ \d+/, 'Second borrower imported as expected'); >+ >+}; >+ >+ > subtest 'test_prepare_columns' => sub { > plan tests => 16; > >-- >2.11.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 23077
:
90415
|
90416
|
90417
|
90418
|
90474
|
90475
|
91181
|
91182
|
91183
|
91315
|
91316
|
91317