|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 11; |
20 |
use Test::More tests => 12; |
| 21 |
|
21 |
|
| 22 |
use C4::Biblio; |
22 |
use C4::Biblio; |
| 23 |
use Koha::Database; |
23 |
use Koha::Database; |
|
Lines 541-543
subtest 'orders() and active_orders_count() tests' => sub {
Link Here
|
| 541 |
|
541 |
|
| 542 |
$schema->storage->txn_rollback; |
542 |
$schema->storage->txn_rollback; |
| 543 |
}; |
543 |
}; |
|
|
544 |
|
| 545 |
subtest 'subscriptions() and subscriptions_count() tests' => sub { |
| 546 |
|
| 547 |
plan tests => 6; |
| 548 |
|
| 549 |
$schema->storage->txn_begin; |
| 550 |
|
| 551 |
my $biblio = $builder->build_sample_biblio; |
| 552 |
|
| 553 |
my $subscriptions = $biblio->subscriptions; |
| 554 |
is( ref($subscriptions), 'Koha::Subscriptions', |
| 555 |
'Koha::Biblio->subscriptions should return a Koha::Subscriptions object' |
| 556 |
); |
| 557 |
is( $subscriptions->count, 0, 'Koha::Biblio->subscriptions should return the correct number of subscriptions'); |
| 558 |
is( $biblio->subscriptions_count, 0, 'subscriptions_count returns the correct number' ); |
| 559 |
|
| 560 |
# Add two subscriptions |
| 561 |
foreach (1..2) { |
| 562 |
$builder->build_object( |
| 563 |
{ |
| 564 |
class => 'Koha::Subscriptions', |
| 565 |
value => { biblionumber => $biblio->biblionumber } |
| 566 |
} |
| 567 |
); |
| 568 |
} |
| 569 |
|
| 570 |
$subscriptions = $biblio->subscriptions; |
| 571 |
is( ref($subscriptions), 'Koha::Subscriptions', |
| 572 |
'Koha::Biblio->subscriptions should return a Koha::Subscriptions object' |
| 573 |
); |
| 574 |
is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions'); |
| 575 |
is( $biblio->subscriptions_count, 2, 'subscriptions_count returns the correct number' ); |
| 576 |
|
| 577 |
$schema->storage->txn_rollback; |
| 578 |
}; |