|
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 => 26; |
109 |
plan tests => 29; |
| 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 212-217
subtest "Update patron categories" => sub {
Link Here
|
| 212 |
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'); |
212 |
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'); |
| 213 |
is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); |
213 |
is( Koha::Patrons->find($inst->borrowernumber)->guarantee_relationships->guarantees->count,0,'Guarantee was removed when made adult'); |
| 214 |
|
214 |
|
|
|
215 |
is( |
| 216 |
Koha::Patrons->search_patrons_to_update_category( { from => $a_categorycode, fine_max => 5 } ) |
| 217 |
->search( { "me.borrowernumber" => $adult1->borrowernumber } )->next->borrowernumber, |
| 218 |
$adult1->borrowernumber, 'Expected patron is in the list of patrons to update' |
| 219 |
); |
| 220 |
my $userid_before = $adult1->userid; |
| 221 |
ok( |
| 222 |
Koha::Patrons->search_patrons_to_update_category( { from => $a_categorycode, fine_max => 5 } ) |
| 223 |
->update_category_to( { category => $a_categorycode_2 } ), |
| 224 |
'Update of patrons is successful including adult1' |
| 225 |
); |
| 226 |
$adult1->discard_changes; |
| 227 |
is( $adult1->userid, $userid_before, "Patron userid not changed by updated" ); |
| 215 |
}; |
228 |
}; |
| 216 |
|
229 |
|
| 217 |
|
230 |
|
| 218 |
- |
|
|