|
Lines 305-321
is( Check_Userid( C4::Context->config('user'), '' ), 0,
Link Here
|
| 305 |
|
305 |
|
| 306 |
subtest 'GetMemberAccountBalance' => sub { |
306 |
subtest 'GetMemberAccountBalance' => sub { |
| 307 |
|
307 |
|
| 308 |
plan tests => 6; |
308 |
plan tests => 10; |
| 309 |
|
309 |
|
| 310 |
my $members_mock = new Test::MockModule('C4::Members'); |
310 |
my $members_mock = new Test::MockModule('C4::Members'); |
| 311 |
$members_mock->mock( 'GetMemberAccountRecords', sub { |
311 |
$members_mock->mock( 'GetMemberAccountRecords', sub { |
| 312 |
my @accountlines = ( |
312 |
my ($borrowernumber) = @_; |
|
|
313 |
if ($borrowernumber) { |
| 314 |
my @accountlines = ( |
| 313 |
{ amountoutstanding => '7', accounttype => 'Rent' }, |
315 |
{ amountoutstanding => '7', accounttype => 'Rent' }, |
| 314 |
{ amountoutstanding => '5', accounttype => 'Res' }, |
316 |
{ amountoutstanding => '5', accounttype => 'Res' }, |
| 315 |
{ amountoutstanding => '3', accounttype => 'Pay' } ); |
317 |
{ amountoutstanding => '3', accounttype => 'Pay' } ); |
| 316 |
return ( 15, \@accountlines ); |
318 |
return ( 15, \@accountlines ); |
|
|
319 |
} |
| 320 |
else { |
| 321 |
my @accountlines; |
| 322 |
return ( 0, \@accountlines ); |
| 323 |
} |
| 317 |
}); |
324 |
}); |
| 318 |
|
325 |
|
|
|
326 |
my $person = GetMemberDetails(undef,undef); |
| 327 |
ok( !$person , 'Expected no member details from undef,undef' ); |
| 328 |
$person = GetMemberDetails(undef,'987654321'); |
| 329 |
is( $person->{amountoutstanding}, 15, |
| 330 |
'Expected 15 outstanding for cardnumber.'); |
| 331 |
$borrowernumber = $person->{borrowernumber}; |
| 332 |
$person = GetMemberDetails($borrowernumber,undef); |
| 333 |
is( $person->{amountoutstanding}, 15, |
| 334 |
'Expected 15 outstanding for borrowernumber.'); |
| 335 |
$person = GetMemberDetails($borrowernumber,'987654321'); |
| 336 |
is( $person->{amountoutstanding}, 15, |
| 337 |
'Expected 15 outstanding for both borrowernumber and cardnumber.'); |
| 338 |
|
| 319 |
# do not count holds charges |
339 |
# do not count holds charges |
| 320 |
C4::Context->set_preference( 'HoldsInNoissuesCharge', '1' ); |
340 |
C4::Context->set_preference( 'HoldsInNoissuesCharge', '1' ); |
| 321 |
C4::Context->set_preference( 'ManInvInNoissuesCharge', '0' ); |
341 |
C4::Context->set_preference( 'ManInvInNoissuesCharge', '0' ); |
| 322 |
- |
|
|