@@ -, +, @@ --- t/db_dependent/Koha/Objects.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) --- a/t/db_dependent/Koha/Objects.t +++ a/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; +}; --