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 => 6; |
848 |
plan tests => 10; |
849 |
|
849 |
|
850 |
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1); |
850 |
t::lib::Mocks::mock_preference('ExtendedPatronAttributes', 1); |
851 |
|
851 |
|
Lines 906-912
subtest 'patron_attributes' => sub {
Link Here
|
906 |
$patron->delete; |
906 |
$patron->delete; |
907 |
} |
907 |
} |
908 |
|
908 |
|
909 |
{ |
909 |
{ # UniqueIDConstraint |
910 |
$builder->build_object( |
910 |
$builder->build_object( |
911 |
{ |
911 |
{ |
912 |
class => 'Koha::Patron::Attributes', |
912 |
class => 'Koha::Patron::Attributes', |
Lines 926-931
subtest 'patron_attributes' => sub {
Link Here
|
926 |
is( $error->{patron_id}, $cardnumber ); |
926 |
is( $error->{patron_id}, $cardnumber ); |
927 |
is( $error->{attribute}->code, $unique_attribute_type->code ); |
927 |
is( $error->{attribute}->code, $unique_attribute_type->code ); |
928 |
|
928 |
|
|
|
929 |
my $patron = Koha::Patrons->find({cardnumber => $cardnumber}); |
930 |
is( $patron, undef, 'Patron is not created' ); |
931 |
} |
932 |
|
933 |
{ #InvalidType |
934 |
my $attributes = { |
935 |
$non_existent_attribute_type_code => ['my non-existent attribute'], |
936 |
$normal_attribute_type->code => ['my attribute 1'], |
937 |
}; |
938 |
my $fh = build_csv({ %$attributes }); |
939 |
|
940 |
my $result = $patrons_import->import_patrons({file => $fh, matchpoint => 'cardnumber'}); |
941 |
my $error = $result->{errors}->[0]; |
942 |
is( $error->{patron_attribute_invalid_type}, 1 ); |
943 |
is( $error->{patron_id}, $cardnumber ); |
944 |
is( $error->{attribute_type_code}, $non_existent_attribute_type_code ); |
945 |
|
929 |
my $patron = Koha::Patrons->find({cardnumber => $cardnumber}); |
946 |
my $patron = Koha::Patrons->find({cardnumber => $cardnumber}); |
930 |
is( $patron, undef ); |
947 |
is( $patron, undef ); |
931 |
|
948 |
|
932 |
- |
|
|