Lines 845-851
subtest 'test_format_dates' => sub {
Link Here
|
845 |
|
845 |
|
846 |
subtest 'patron_attributes' => sub { |
846 |
subtest 'patron_attributes' => sub { |
847 |
|
847 |
|
848 |
plan tests => 10; |
848 |
plan tests => 16; |
849 |
|
849 |
|
850 |
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1); |
850 |
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1); |
851 |
|
851 |
|
Lines 938-943
subtest 'patron_attributes' => sub {
Link Here
|
938 |
my $fh = build_csv({ %$attributes }); |
938 |
my $fh = build_csv({ %$attributes }); |
939 |
|
939 |
|
940 |
my $result = $patrons_import->import_patrons({file => $fh, matchpoint => 'cardnumber'}); |
940 |
my $result = $patrons_import->import_patrons({file => $fh, matchpoint => 'cardnumber'}); |
|
|
941 |
is( $result->{imported}, 0 ); |
942 |
|
941 |
my $error = $result->{errors}->[0]; |
943 |
my $error = $result->{errors}->[0]; |
942 |
is( $error->{patron_attribute_invalid_type}, 1 ); |
944 |
is( $error->{patron_attribute_invalid_type}, 1 ); |
943 |
is( $error->{patron_id}, $cardnumber ); |
945 |
is( $error->{patron_id}, $cardnumber ); |
Lines 948-953
subtest 'patron_attributes' => sub {
Link Here
|
948 |
|
950 |
|
949 |
} |
951 |
} |
950 |
|
952 |
|
|
|
953 |
{ # NonRepeatable |
954 |
my $attributes = { |
955 |
$repeatable_attribute_type->code => ['my repeatable attribute 1', 'my repeatable attribute 2'], |
956 |
$normal_attribute_type->code => ['my normal attribute 1', 'my normal attribute 2'], |
957 |
}; |
958 |
my $fh = build_csv({ %$attributes }); |
959 |
my $result = $patrons_import->import_patrons({file => $fh, matchpoint => 'cardnumber'}); |
960 |
is( $result->{imported}, 0 ); |
961 |
|
962 |
my $error = $result->{errors}->[0]; |
963 |
is( $error->{patron_attribute_non_repeatable}, 1 ); |
964 |
is( $error->{patron_id}, $cardnumber ); |
965 |
is( $error->{attribute}->code, $normal_attribute_type->code ); |
966 |
|
967 |
my $patron = Koha::Patrons->find({cardnumber => $cardnumber}); |
968 |
is( $patron, undef ); |
969 |
} |
970 |
|
951 |
}; |
971 |
}; |
952 |
|
972 |
|
953 |
# got is { code => $code, attribute => $attribute } |
973 |
# got is { code => $code, attribute => $attribute } |
954 |
- |
|
|