Lines 896-902
subtest 'get_volumes_query' => sub {
Link Here
|
896 |
); |
896 |
); |
897 |
}; |
897 |
}; |
898 |
|
898 |
|
899 |
subtest 'orders() and active_orders() tests' => sub { |
899 |
subtest 'orders() and uncancelled_orders() tests' => sub { |
900 |
|
900 |
|
901 |
plan tests => 5; |
901 |
plan tests => 5; |
902 |
|
902 |
|
Lines 904-914
subtest 'orders() and active_orders() tests' => sub {
Link Here
|
904 |
|
904 |
|
905 |
my $biblio = $builder->build_sample_biblio(); |
905 |
my $biblio = $builder->build_sample_biblio(); |
906 |
|
906 |
|
907 |
my $orders = $biblio->orders; |
907 |
my $orders = $biblio->orders; |
908 |
my $active_orders = $biblio->active_orders; |
908 |
my $uncancelled_orders = $biblio->uncancelled_orders; |
909 |
|
909 |
|
910 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
910 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
911 |
is( $biblio->orders->count, $biblio->active_orders->count, '->orders->count returns the count for the resultset' ); |
911 |
is( |
|
|
912 |
$biblio->orders->count, $biblio->uncancelled_orders->count, |
913 |
'->orders->count returns the count for the resultset' |
914 |
); |
912 |
|
915 |
|
913 |
# Add a couple orders |
916 |
# Add a couple orders |
914 |
foreach (1..2) { |
917 |
foreach (1..2) { |
Lines 933-944
subtest 'orders() and active_orders() tests' => sub {
Link Here
|
933 |
} |
936 |
} |
934 |
); |
937 |
); |
935 |
|
938 |
|
936 |
$orders = $biblio->orders; |
939 |
$orders = $biblio->orders; |
937 |
$active_orders = $biblio->active_orders; |
940 |
$uncancelled_orders = $biblio->uncancelled_orders; |
938 |
|
941 |
|
939 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
942 |
is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
940 |
is( ref($active_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
943 |
is( ref($uncancelled_orders), 'Koha::Acquisition::Orders', 'Result type is correct' ); |
941 |
is( $orders->count, $active_orders->count + 2, '->active_orders->count returns the rigt count' ); |
944 |
is( $orders->count, $uncancelled_orders->count + 2, '->uncancelled_orders->count returns the right count' ); |
942 |
|
945 |
|
943 |
$schema->storage->txn_rollback; |
946 |
$schema->storage->txn_rollback; |
944 |
}; |
947 |
}; |
945 |
- |
|
|