|
Lines 660-666
subtest 'get_volumes_query' => sub {
Link Here
|
| 660 |
); |
660 |
); |
| 661 |
}; |
661 |
}; |
| 662 |
|
662 |
|
| 663 |
subtest 'orders() and active_orders() tests' => sub { |
663 |
subtest 'orders() and uncancelled_orders() tests' => sub { |
| 664 |
|
664 |
|
| 665 |
plan tests => 5; |
665 |
plan tests => 5; |
| 666 |
|
666 |
|
|
Lines 668-678
subtest 'orders() and active_orders() tests' => sub {
Link Here
|
| 668 |
|
668 |
|
| 669 |
my $biblio = $builder->build_sample_biblio(); |
669 |
my $biblio = $builder->build_sample_biblio(); |
| 670 |
|
670 |
|
| 671 |
my $orders = $biblio->orders; |
671 |
my $orders = $biblio->orders; |
| 672 |
my $active_orders = $biblio->active_orders; |
672 |
my $uncancelled_orders = $biblio->uncancelled_orders; |
| 673 |
|
673 |
|
| 674 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
674 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
| 675 |
is( $biblio->orders->count, $biblio->active_orders->count, '->orders->count returns the count for the resultset' ); |
675 |
is( |
|
|
676 |
$biblio->orders->count, $biblio->uncancelled_orders->count, |
| 677 |
'->orders->count returns the count for the resultset' |
| 678 |
); |
| 676 |
|
679 |
|
| 677 |
# Add a couple orders |
680 |
# Add a couple orders |
| 678 |
foreach (1..2) { |
681 |
foreach (1..2) { |
|
Lines 697-708
subtest 'orders() and active_orders() tests' => sub {
Link Here
|
| 697 |
} |
700 |
} |
| 698 |
); |
701 |
); |
| 699 |
|
702 |
|
| 700 |
$orders = $biblio->orders; |
703 |
$orders = $biblio->orders; |
| 701 |
$active_orders = $biblio->active_orders; |
704 |
$uncancelled_orders = $biblio->uncancelled_orders; |
| 702 |
|
705 |
|
| 703 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
706 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
| 704 |
is( ref($active_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
707 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
| 705 |
is( $orders->count, $active_orders->count + 2, '->active_orders->count returns the rigt count' ); |
708 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
| 706 |
|
709 |
|
| 707 |
$schema->storage->txn_rollback; |
710 |
$schema->storage->txn_rollback; |
| 708 |
}; |
711 |
}; |
| 709 |
- |
|
|