Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 5; |
22 |
use Test::More tests => 6; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use Koha::Account; |
25 |
use Koha::Account; |
Lines 298-300
subtest 'Keep account info when a patron is deleted' => sub {
Link Here
|
298 |
|
298 |
|
299 |
$schema->storage->txn_rollback; |
299 |
$schema->storage->txn_rollback; |
300 |
}; |
300 |
}; |
301 |
- |
301 |
|
|
|
302 |
subtest 'issue() tests' => sub { |
303 |
|
304 |
plan tests => 5; |
305 |
|
306 |
$schema->storage->txn_begin; |
307 |
|
308 |
my $library = $builder->build( { source => 'Branch' } ); |
309 |
my $patron = $builder->build( { source => 'Borrower' } ); |
310 |
my $item = $builder->build( { source => 'Item' } ); |
311 |
|
312 |
my $checkout = Koha::Checkout->new( |
313 |
{ borrowernumber => $patron->{borrowernumber}, |
314 |
itemnumber => $item->{itemnumber}, |
315 |
branchcode => $library->{branchcode}, |
316 |
})->store; |
317 |
|
318 |
my $line = Koha::Account::Line->new( |
319 |
{ |
320 |
borrowernumber => $patron->{borrowernumber}, |
321 |
itemnumber => $item->{itemnumber}, |
322 |
issue_id => $checkout->issue_id, |
323 |
accounttype => "F", |
324 |
amount => 10, |
325 |
})->store; |
326 |
|
327 |
my $line_issue = $line->issue; |
328 |
is( ref($line_issue), 'Koha::Checkout', 'Result type is correct' ); |
329 |
is( $line_issue->issue_id, $checkout->issue_id, 'Koha::Account::Line->issue should return the correct issue'); |
330 |
|
331 |
my ( $returned, undef, $old_checkout) = C4::Circulation::AddReturn( $item->{barcode} ,$library->{branchcode} ); |
332 |
is( $returned, 1, 'The item should have been returned' ); |
333 |
|
334 |
my $old_line_issue = $line->issue; |
335 |
is( ref($old_line_issue), 'Koha::Old::Checkout', 'Result type is correct' ); |
336 |
is( $old_line_issue->issue_id, $old_checkout->issue_id, 'Koha::Account::Line->issue should return the correct old_issue' ); |
337 |
|
338 |
$schema->storage->txn_rollback; |
339 |
}; |