Bug 27021: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomás Cohen Arazi 2020-11-13 15:47:39 -03:00 committed by Jonathan Druart
parent 36d46c6510
commit a386954b8b

View file

@ -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',