|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 1; |
22 |
use Test::More tests => 2; |
| 23 |
|
23 |
|
| 24 |
use Koha::Account::Lines; |
24 |
use Koha::Account::Lines; |
| 25 |
use Koha::Items; |
25 |
use Koha::Items; |
|
Lines 60-65
subtest 'item' => sub {
Link Here
|
| 60 |
is( $line->itemnumber, $account_line_item->itemnumber, 'Koha::Account::Line->item should return the correct item' ); |
60 |
is( $line->itemnumber, $account_line_item->itemnumber, 'Koha::Account::Line->item should return the correct item' ); |
| 61 |
}; |
61 |
}; |
| 62 |
|
62 |
|
|
|
63 |
subtest 'checkout' => sub { |
| 64 |
plan tests => 1; |
| 65 |
|
| 66 |
my $library = $builder->build( { source => 'Branch' } ); |
| 67 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
| 68 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 69 |
my $item = Koha::Item->new( |
| 70 |
{ |
| 71 |
biblionumber => $biblioitem->{biblionumber}, |
| 72 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
| 73 |
homebranch => $library->{branchcode}, |
| 74 |
holdingbranch => $library->{branchcode}, |
| 75 |
barcode => 'some_barcode_13', |
| 76 |
itype => 'BK', |
| 77 |
})->store; |
| 78 |
|
| 79 |
my $checkout = Koha::Checkout->new( |
| 80 |
{ borrowernumber => $patron->{borrowernumber}, |
| 81 |
itemnumber => $item->itemnumber, |
| 82 |
branchcode => $library->{branchcode}, |
| 83 |
} |
| 84 |
)->store; |
| 85 |
|
| 86 |
my $line = Koha::Account::Line->new( |
| 87 |
{ |
| 88 |
borrowernumber => $patron->{borrowernumber}, |
| 89 |
itemnumber => $item->itemnumber, |
| 90 |
issue_id => $checkout->id, |
| 91 |
accounttype => "F", |
| 92 |
amount => 10, |
| 93 |
})->store; |
| 94 |
|
| 95 |
is( $line->checkout->id, $checkout->id, 'Koha::Account::Line->checkout should return the correct checkout' ); |
| 96 |
}; |
| 97 |
|
| 63 |
$schema->storage->txn_rollback; |
98 |
$schema->storage->txn_rollback; |
| 64 |
|
99 |
|
| 65 |
1; |
100 |
1; |
| 66 |
- |
|
|