From 4ee380177bca5da6bb4c0a9b6eda1a48519ef497 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 27 Apr 2020 18:32:50 -0300 Subject: [PATCH] Bug 25296: Unit tests Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- t/db_dependent/Koha/Objects.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index c5ac1ba2b6..2af778a85a 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 21; +use Test::More tests => 22; use Test::Exception; use Test::Warn; @@ -799,3 +799,20 @@ subtest 'prefetch_whitelist() tests' => sub { $schema->storage->txn_rollback; }; + +subtest 'empty() tests' => sub { + + plan tests => 3; + + $schema->storage->txn_begin; + + # Add a patron, we need more than 0 + $builder->build_object({ class => 'Koha::Patrons' }); + ok( Koha::Patrons->count > 0, 'There is more than one Koha::Patron on the resultset' ); + + my $empty = Koha::Patrons->new->empty; + is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' ); + is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); + + $schema->storage->txn_rollback; +}; -- 2.20.1