Lines 18-24
Link Here
|
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
use Test::More tests => 155; |
21 |
use Test::More tests => 156; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
24 |
# To be replaced by t::lib::Mock |
24 |
# To be replaced by t::lib::Mock |
Lines 376-381
is($result_7->{imported}, 1, 'Got the expected 1 imported result from import pat
Link Here
|
376 |
is($result_7->{invalid}, 1, 'Got the expected 1 invalid result from import patrons for dates tests'); |
376 |
is($result_7->{invalid}, 1, 'Got the expected 1 invalid result from import patrons for dates tests'); |
377 |
is($result_7->{overwritten}, 0, 'Got the expected 0 overwritten result from import patrons for dates tests'); |
377 |
is($result_7->{overwritten}, 0, 'Got the expected 0 overwritten result from import patrons for dates tests'); |
378 |
|
378 |
|
|
|
379 |
subtest 'test_import_without_cardnumber' => sub { |
380 |
plan tests => 2; |
381 |
|
382 |
#Remove possible existing user with a "" as cardnumber |
383 |
my $blank_card = Koha::Patrons->find({ cardnumber => '' }); |
384 |
$blank_card->delete if $blank_card; |
385 |
|
386 |
my $branchcode = $builder->build({ source => "Branch"})->{branchcode}; |
387 |
my $categorycode = $builder->build({ source => "Category"})->{categorycode}; |
388 |
my $csv_headers = 'surname, branchcode, categorycode'; |
389 |
my $res_headers = 'surname, branchcode, categorycode'; |
390 |
my $csv_nocard_1 = "Squarepants,$branchcode,$categorycode"; |
391 |
my $csv_nocard_2 = "Star,$branchcode,$categorycode"; |
392 |
|
393 |
my $filename_1 = make_csv($temp_dir, $csv_headers, $csv_nocard_1, $csv_nocard_2); |
394 |
open(my $handle_1, "<", $filename_1) or die "cannot open < $filename_1: $!"; |
395 |
my $params_1 = { file => $handle_1, }; |
396 |
|
397 |
my $defaults = { cardnumber => "" }; #currently all the defaults come as "" if not filled |
398 |
|
399 |
my $result = $patrons_import->import_patrons($params_1, $defaults); |
400 |
warn Data::Dumper::Dumper( $result ); |
401 |
like($result->{feedback}->[1]->{value}, qr/^Squarepants \/ \d+/, 'First borrower imported as expected'); |
402 |
like($result->{feedback}->[2]->{value}, qr/^Star \/ \d+/, 'Second borrower imported as expected'); |
403 |
|
404 |
}; |
405 |
|
406 |
|
379 |
subtest 'test_prepare_columns' => sub { |
407 |
subtest 'test_prepare_columns' => sub { |
380 |
plan tests => 16; |
408 |
plan tests => 16; |
381 |
|
409 |
|
382 |
- |
|
|