Lines 106-112
foreach my $b ( $patrons->as_list() ) {
Link Here
|
106 |
} |
106 |
} |
107 |
|
107 |
|
108 |
subtest "Update patron categories" => sub { |
108 |
subtest "Update patron categories" => sub { |
109 |
plan tests => 24; |
109 |
plan tests => 28; |
110 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); |
110 |
t::lib::Mocks::mock_preference( 'borrowerRelationship', 'test' ); |
111 |
my $c_categorycode = $builder->build({ source => 'Category', value => { |
111 |
my $c_categorycode = $builder->build({ source => 'Category', value => { |
112 |
category_type=>'C', |
112 |
category_type=>'C', |
Lines 207-212
subtest "Update patron categories" => sub {
Link Here
|
207 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$p_categorycode})->update_category_to({category=>$a_categorycode}),1,'One professional patron updated to adult category'); |
207 |
is( Koha::Patrons->search_patrons_to_update_category({from=>$p_categorycode})->update_category_to({category=>$a_categorycode}),1,'One professional patron updated to adult category'); |
208 |
is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); |
208 |
is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); |
209 |
|
209 |
|
|
|
210 |
my $adult4 = $builder->build_object({class => 'Koha::Patrons', value => { |
211 |
categorycode=>$a_categorycode, |
212 |
branchcode=>$branchcode2, |
213 |
dateenrolled=>'2017-01-01', |
214 |
} |
215 |
}); |
216 |
my $child4 = $builder->build_object({class => 'Koha::Patrons', value => { |
217 |
dateofbirth => dt_from_string->add(years=>-18), |
218 |
categorycode=>$c_categorycode, |
219 |
branchcode=>$branchcode1, |
220 |
} |
221 |
}); |
222 |
$child4->add_guarantor({guarantor_id => $adult4->borrowernumber, relationship => 'test'}); |
223 |
|
224 |
is( $adult4->guarantee_relationships->count, 1, "Adult has guarantee relationship" ); |
225 |
is( $child4->guarantor_relationships->count, 1, "Child has guarantor relationship" ); |
226 |
$adult4->categorycode($c_categorycode); |
227 |
$adult4->store(); |
228 |
is( $adult4->guarantee_relationships->count, 0, "Adult turned child now has no guarantee relationship" ); |
229 |
is( $child4->guarantor_relationships->count, 0, "Child of adult now turned child has no guarantor relationship" ); |
210 |
}; |
230 |
}; |
211 |
|
231 |
|
212 |
|
232 |
|
213 |
- |
|
|