From ce2bfbe166022d240c4b3aeee5ab1d9e4b9f0095 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 16 Jan 2020 13:32:04 -0300 Subject: [PATCH] Bug 24435: Unit tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: David Nind Signed-off-by: Nick Clemens --- t/db_dependent/Koha/Biblio.t | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 91017eeaae..4ce758a727 100644 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -91,19 +91,23 @@ subtest 'hidden_in_opac() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'items() tests' => sub { +subtest 'items() and items_count() tests' => sub { - plan tests => 3; + plan tests => 5; $schema->storage->txn_begin; my $biblio = $builder->build_sample_biblio(); + + is( $biblio->items_count, 0, 'No items, count is 0' ); + my $item_1 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); my $item_2 = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); my $items = $biblio->items; is( ref($items), 'Koha::Items', 'Returns a Koha::Items resultset' ); is( $items->count, 2, 'Two items in resultset' ); + is( $biblio->items_count, $items->count, 'items_count returns the expected value' ); my @items = $biblio->items->as_list; is( scalar @items, 2, 'Same result, but in list context' ); -- 2.11.0