Lines 112-127
subtest "Update patron categories" => sub {
Link Here
|
112 |
category_type=>'C', |
112 |
category_type=>'C', |
113 |
upperagelimit=>17, |
113 |
upperagelimit=>17, |
114 |
dateofbirthrequired=>5, |
114 |
dateofbirthrequired=>5, |
115 |
can_be_guarantee=>1, |
115 |
canbeguarantee=>1, |
116 |
} })->{categorycode}; |
116 |
} })->{categorycode}; |
117 |
my $c_categorycode_2 = $builder->build({ source => 'Category', value => { |
117 |
my $c_categorycode_2 = $builder->build({ source => 'Category', value => { |
118 |
category_type=>'C', |
118 |
category_type=>'C', |
119 |
upperagelimit=>17, |
119 |
upperagelimit=>17, |
120 |
dateofbirthrequired=>5, |
120 |
dateofbirthrequired=>5, |
121 |
can_be_guarantee=>1, |
121 |
canbeguarantee=>1, |
122 |
} })->{categorycode}; |
122 |
} })->{categorycode}; |
123 |
my $a_categorycode = $builder->build({ source => 'Category', value => {category_type=>'A', can_be_guarantee=>0} })->{categorycode}; |
123 |
my $a_categorycode = $builder->build({ source => 'Category', value => {category_type=>'A', canbeguarantee=>0} })->{categorycode}; |
124 |
my $a_categorycode_2 = $builder->build({ source => 'Category', value => {category_type=>'A', can_be_guarantee=>1} })->{categorycode}; |
124 |
my $a_categorycode_2 = $builder->build({ source => 'Category', value => {category_type=>'A', canbeguarantee=>1} })->{categorycode}; |
125 |
my $p_categorycode = $builder->build({ source => 'Category', value => {category_type=>'P'} })->{categorycode}; |
125 |
my $p_categorycode = $builder->build({ source => 'Category', value => {category_type=>'P'} })->{categorycode}; |
126 |
my $i_categorycode = $builder->build({ source => 'Category', value => {category_type=>'I'} })->{categorycode}; |
126 |
my $i_categorycode = $builder->build({ source => 'Category', value => {category_type=>'I'} })->{categorycode}; |
127 |
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode}; |
127 |
my $branchcode1 = $builder->build({ source => 'Branch' })->{branchcode}; |
Lines 201-206
subtest "Update patron categories" => sub {
Link Here
|
201 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->next->borrowernumber, $child1->borrowernumber ); |
201 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->next->borrowernumber, $child1->borrowernumber ); |
202 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too young'); |
202 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_young=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too young'); |
203 |
is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); |
203 |
is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantee was removed when made adult'); |
|
|
204 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2})->update_category_to({category=>$a_categorycode_2}),2,'Two child patrons updated to adult category'); |
205 |
is( Koha::Patrons->find($adult1->borrowernumber)->guarantee_relationships->guarantees->count,2,'Guarantees were not removed when made adult which can be guarantee'); |
204 |
|
206 |
|
205 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->next->borrowernumber, $child3->borrowernumber ); |
207 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->next->borrowernumber, $child3->borrowernumber ); |
206 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too old'); |
208 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$c_categorycode_2,too_old=>1})->update_category_to({category=>$a_categorycode}),1,'One child patron updated to adult category because too old'); |
207 |
- |
|
|