|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 9; |
22 |
use Test::More tests => 10; |
| 23 |
use t::lib::TestBuilder; |
23 |
use t::lib::TestBuilder; |
| 24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
| 25 |
|
25 |
|
|
Lines 271-273
subtest 'authorizer' => sub {
Link Here
|
| 271 |
|
271 |
|
| 272 |
$schema->storage->txn_rollback; |
272 |
$schema->storage->txn_rollback; |
| 273 |
}; |
273 |
}; |
| 274 |
- |
274 |
|
|
|
275 |
subtest 'orders' => sub { |
| 276 |
|
| 277 |
plan tests => 4; |
| 278 |
|
| 279 |
$schema->storage->txn_begin; |
| 280 |
|
| 281 |
my $basket = $builder->build_object( |
| 282 |
{ |
| 283 |
class => 'Koha::Acquisition::Baskets' |
| 284 |
} |
| 285 |
); |
| 286 |
|
| 287 |
my $orders = $basket->orders; |
| 288 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Type is correct with no attached orders' ); |
| 289 |
is( $orders->count, 0, 'No orders attached, count 0' ); |
| 290 |
|
| 291 |
my @actual_orders; |
| 292 |
|
| 293 |
for ( 1..10 ) { |
| 294 |
push @actual_orders, $builder->build_object({ class => 'Koha::Acquisition::Orders', value => { basketno => $basket->id } }); |
| 295 |
} |
| 296 |
|
| 297 |
$orders = $basket->orders; |
| 298 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Type is correct with no attached orders' ); |
| 299 |
is( $orders->count, 10, '10 orders attached, count 10' ); |
| 300 |
|
| 301 |
$schema->storage->txn_rollback; |
| 302 |
}; |