From 9eaf0d33fb5f5e23195a579d5b1fc4cec70c5d6a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 13 Nov 2020 15:47:39 -0300 Subject: [PATCH] Bug 27021: Regression tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Objects.t | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index 76e0393485d..265d327c4e9 100755 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -1204,18 +1204,22 @@ subtest 'prefetch_whitelist() tests' => sub { subtest 'empty() tests' => sub { - plan tests => 5; + plan tests => 6; $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' ); + # Add a patron, we need at least 1 + my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + ok( Koha::Patrons->count > 0, 'There is at least 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' ); + my $new_rs = $empty->search({ borrowernumber => $patron->borrowernumber }); + + is( $new_rs->count, 0, 'Further chaining an empty resultset, returns an empty resultset' ); + throws_ok { Koha::Patrons->empty; } 'Koha::Exceptions::Object::NotInstantiated', -- 2.29.2