Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 23; |
22 |
use Test::More tests => 24; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
use DateTime; |
24 |
use DateTime; |
25 |
|
25 |
|
Lines 1001-1006
subtest 'account_locked' => sub {
Link Here
|
1001 |
$patron->delete; |
1001 |
$patron->delete; |
1002 |
}; |
1002 |
}; |
1003 |
|
1003 |
|
|
|
1004 |
subtest 'is_child | is_adult' => sub { |
1005 |
plan tests => 8; |
1006 |
my $category = $builder->build_object( |
1007 |
{ |
1008 |
class => 'Koha::Patron::Categories', |
1009 |
value => { category_type => 'A' } |
1010 |
} |
1011 |
); |
1012 |
my $patron_adult = $builder->build_object( |
1013 |
{ |
1014 |
class => 'Koha::Patrons', |
1015 |
value => { categorycode => $category->categorycode } |
1016 |
} |
1017 |
); |
1018 |
$category = $builder->build_object( |
1019 |
{ |
1020 |
class => 'Koha::Patron::Categories', |
1021 |
value => { category_type => 'I' } |
1022 |
} |
1023 |
); |
1024 |
my $patron_adult_i = $builder->build_object( |
1025 |
{ |
1026 |
class => 'Koha::Patrons', |
1027 |
value => { categorycode => $category->categorycode } |
1028 |
} |
1029 |
); |
1030 |
$category = $builder->build_object( |
1031 |
{ |
1032 |
class => 'Koha::Patron::Categories', |
1033 |
value => { category_type => 'C' } |
1034 |
} |
1035 |
); |
1036 |
my $patron_child = $builder->build_object( |
1037 |
{ |
1038 |
class => 'Koha::Patrons', |
1039 |
value => { categorycode => $category->categorycode } |
1040 |
} |
1041 |
); |
1042 |
$category = $builder->build_object( |
1043 |
{ |
1044 |
class => 'Koha::Patron::Categories', |
1045 |
value => { category_type => 'O' } |
1046 |
} |
1047 |
); |
1048 |
my $patron_other = $builder->build_object( |
1049 |
{ |
1050 |
class => 'Koha::Patrons', |
1051 |
value => { categorycode => $category->categorycode } |
1052 |
} |
1053 |
); |
1054 |
is( $patron_adult->is_adult, 1, 'Patron from category A should be considered adult' ); |
1055 |
is( $patron_adult_i->is_adult, 1, 'Patron from category I should be considered adult' ); |
1056 |
is( $patron_child->is_adult, 0, 'Patron from category C should not be considered adult' ); |
1057 |
is( $patron_other->is_adult, 0, 'Patron from category O should not be considered adult' ); |
1058 |
|
1059 |
is( $patron_adult->is_child, 0, 'Patron from category A should be considered child' ); |
1060 |
is( $patron_adult_i->is_child, 0, 'Patron from category I should be considered child' ); |
1061 |
is( $patron_child->is_child, 1, 'Patron from category C should not be considered child' ); |
1062 |
is( $patron_other->is_child, 0, 'Patron from category O should not be considered child' ); |
1063 |
|
1064 |
# Clean up |
1065 |
$patron_adult->delete; |
1066 |
$patron_adult_i->delete; |
1067 |
$patron_child->delete; |
1068 |
$patron_other->delete; |
1069 |
}; |
1070 |
|
1004 |
$retrieved_patron_1->delete; |
1071 |
$retrieved_patron_1->delete; |
1005 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
1072 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
1006 |
|
1073 |
|
1007 |
- |
|
|