View | Details | Raw Unified | Return to bug 29005
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Patrons/Import.t (-2 / +27 lines)
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 => 173;
21
use Test::More tests => 174;
22
use Test::Warn;
22
use Test::Warn;
23
use Test::Exception;
23
use Test::Exception;
24
use Encode qw( encode_utf8 );
24
use Encode qw( encode_utf8 );
Lines 1143-1148 subtest 'patron_attributes' => sub { Link Here
1143
1143
1144
};
1144
};
1145
1145
1146
subtest 'welcome_email' => sub {
1147
1148
    plan tests => 3;
1149
1150
    #Setup our info
1151
    my $branchcode = $builder->build({ source => "Branch"})->{branchcode};
1152
    my $categorycode = $builder->build({ source => "Category", value => { category_type => 'A'  } })->{categorycode};
1153
    my $staff_categorycode = $builder->build({ source => "Category", value => { category_type => 'S'  } })->{categorycode};
1154
    my $csv_headers  = 'surname,userid,branchcode,categorycode,password,email';
1155
    my $csv_new      = "Spagobi,EldridgeS,$branchcode,$categorycode,H4ckR".',me@myemail.com';
1156
    my $defaults = { cardnumber => "" }; #currently all the defaults come as "" if not filled
1157
1158
    #Make the test files for importing
1159
    my $filename_1 = make_csv($temp_dir, $csv_headers, $csv_new);
1160
    open(my $handle_1, "<", $filename_1) or die "cannot open < $filename_1: $!";
1161
1162
    my $params_1 = { file => $handle_1, matchpoint => 'userid', overwrite_passwords => 1, overwrite_cardnumber => 1, send_welcome => 1};
1163
1164
    my $result = $patrons_import->import_patrons($params_1, $defaults);
1165
    is($result->{already_in_db}, 0, 'New borrower imported as expected');
1166
    is($result->{feedback}->[3]->{name}, 'welcome_sent', 'Email send reported');
1167
    my $eldridge = Koha::Patrons->find({ userid => 'EldridgeS'});
1168
    my $notices = Koha::Notice::Messages->search({ borrowernumber => $eldridge->borrowernumber });
1169
    is($notices->count, 1, 'Notice was queued');
1170
};
1171
1146
# got is { code => $code, attribute => $attribute }
1172
# got is { code => $code, attribute => $attribute }
1147
# expected is { $code => \@attributes }
1173
# expected is { $code => \@attributes }
1148
sub compare_patron_attributes {
1174
sub compare_patron_attributes {
1149
- 

Return to bug 29005