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:
parent
36d46c6510
commit
a386954b8b
1 changed files with 8 additions and 4 deletions
|
@ -1204,18 +1204,22 @@ subtest 'prefetch_whitelist() tests' => sub {
|
||||||
|
|
||||||
subtest 'empty() tests' => sub {
|
subtest 'empty() tests' => sub {
|
||||||
|
|
||||||
plan tests => 5;
|
plan tests => 6;
|
||||||
|
|
||||||
$schema->storage->txn_begin;
|
$schema->storage->txn_begin;
|
||||||
|
|
||||||
# Add a patron, we need more than 0
|
# Add a patron, we need at least 1
|
||||||
$builder->build_object({ class => 'Koha::Patrons' });
|
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
|
||||||
ok( Koha::Patrons->count > 0, 'There is more than one Koha::Patron on the resultset' );
|
ok( Koha::Patrons->count > 0, 'There is at least one Koha::Patron on the resultset' );
|
||||||
|
|
||||||
my $empty = Koha::Patrons->new->empty;
|
my $empty = Koha::Patrons->new->empty;
|
||||||
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' );
|
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' );
|
||||||
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' );
|
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
|
throws_ok
|
||||||
{ Koha::Patrons->empty; }
|
{ Koha::Patrons->empty; }
|
||||||
'Koha::Exceptions::Object::NotInstantiated',
|
'Koha::Exceptions::Object::NotInstantiated',
|
||||||
|
|
Loading…
Reference in a new issue