|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 15; |
22 |
use Test::More tests => 16; |
| 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 1208-1211
subtest "reduce() tests" => sub {
Link Here
|
| 1208 |
$schema->storage->txn_rollback; |
1208 |
$schema->storage->txn_rollback; |
| 1209 |
}; |
1209 |
}; |
| 1210 |
|
1210 |
|
|
|
1211 |
subtest 'checkout' => sub { |
| 1212 |
plan tests => 1; |
| 1213 |
|
| 1214 |
$schema->storage->txn_begin; |
| 1215 |
|
| 1216 |
my $library = $builder->build( { source => 'Branch' } ); |
| 1217 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
| 1218 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 1219 |
my $item = Koha::Item->new( |
| 1220 |
{ |
| 1221 |
biblionumber => $biblioitem->{biblionumber}, |
| 1222 |
biblioitemnumber => $biblioitem->{biblioitemnumber}, |
| 1223 |
homebranch => $library->{branchcode}, |
| 1224 |
holdingbranch => $library->{branchcode}, |
| 1225 |
barcode => 'some_barcode_13', |
| 1226 |
itype => 'BK', |
| 1227 |
} |
| 1228 |
)->store; |
| 1229 |
|
| 1230 |
my $checkout = Koha::Checkout->new( |
| 1231 |
{ |
| 1232 |
borrowernumber => $patron->{borrowernumber}, |
| 1233 |
itemnumber => $item->itemnumber, |
| 1234 |
branchcode => $library->{branchcode}, |
| 1235 |
} |
| 1236 |
)->store; |
| 1237 |
|
| 1238 |
my $line = Koha::Account::Line->new( |
| 1239 |
{ |
| 1240 |
borrowernumber => $patron->{borrowernumber}, |
| 1241 |
itemnumber => $item->itemnumber, |
| 1242 |
issue_id => $checkout->id, |
| 1243 |
accounttype => "F", |
| 1244 |
amount => 10, |
| 1245 |
interface => 'commandline', |
| 1246 |
} |
| 1247 |
)->store; |
| 1248 |
|
| 1249 |
is( $line->checkout->id, $checkout->id, |
| 1250 |
'Koha::Account::Line->checkout should return the correct checkout' ); |
| 1251 |
|
| 1252 |
$schema->storage->txn_rollback; |
| 1253 |
}; |
| 1254 |
|
| 1211 |
1; |
1255 |
1; |
| 1212 |
- |
|
|