|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
|
24 |
|
| 25 |
use C4::Circulation qw/AddIssue AddReturn/; |
25 |
use C4::Circulation qw/AddIssue AddReturn/; |
|
Lines 561-564
subtest "void() tests" => sub {
Link Here
|
| 561 |
$schema->storage->txn_rollback; |
561 |
$schema->storage->txn_rollback; |
| 562 |
}; |
562 |
}; |
| 563 |
|
563 |
|
|
|
564 |
subtest 'checkout' => sub { |
| 565 |
plan tests => 1; |
| 566 |
|
| 567 |
$schema->storage->txn_begin; |
| 568 |
|
| 569 |
my $library = $builder->build( { source => 'Branch' } ); |
| 570 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
| 571 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 572 |
my $item = Koha::Item->new( |
| 573 |
{ |
| 574 |
biblionumber => $biblioitem->{biblionumber}, |
| 575 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
| 576 |
homebranch => $library->{branchcode}, |
| 577 |
holdingbranch => $library->{branchcode}, |
| 578 |
barcode => 'some_barcode_13', |
| 579 |
itype => 'BK', |
| 580 |
} |
| 581 |
)->store; |
| 582 |
|
| 583 |
my $checkout = Koha::Checkout->new( |
| 584 |
{ |
| 585 |
borrowernumber => $patron->{borrowernumber}, |
| 586 |
itemnumber => $item->itemnumber, |
| 587 |
branchcode => $library->{branchcode}, |
| 588 |
} |
| 589 |
)->store; |
| 590 |
|
| 591 |
my $line = Koha::Account::Line->new( |
| 592 |
{ |
| 593 |
borrowernumber => $patron->{borrowernumber}, |
| 594 |
itemnumber => $item->itemnumber, |
| 595 |
issue_id => $checkout->id, |
| 596 |
accounttype => "F", |
| 597 |
amount => 10, |
| 598 |
interface => 'commandline', |
| 599 |
} |
| 600 |
)->store; |
| 601 |
|
| 602 |
is( $line->checkout->id, $checkout->id, |
| 603 |
'Koha::Account::Line->checkout should return the correct checkout' ); |
| 604 |
|
| 605 |
$schema->storage->txn_rollback; |
| 606 |
}; |
| 607 |
|
| 564 |
1; |
608 |
1; |
| 565 |
- |
|
|