Lines 1204-1221
subtest 'prefetch_whitelist() tests' => sub {
Link Here
|
1204 |
|
1204 |
|
1205 |
subtest 'empty() tests' => sub { |
1205 |
subtest 'empty() tests' => sub { |
1206 |
|
1206 |
|
1207 |
plan tests => 5; |
1207 |
plan tests => 6; |
1208 |
|
1208 |
|
1209 |
$schema->storage->txn_begin; |
1209 |
$schema->storage->txn_begin; |
1210 |
|
1210 |
|
1211 |
# Add a patron, we need more than 0 |
1211 |
# Add a patron, we need at least 1 |
1212 |
$builder->build_object({ class => 'Koha::Patrons' }); |
1212 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
1213 |
ok( Koha::Patrons->count > 0, 'There is more than one Koha::Patron on the resultset' ); |
1213 |
ok( Koha::Patrons->count > 0, 'There is at least one Koha::Patron on the resultset' ); |
1214 |
|
1214 |
|
1215 |
my $empty = Koha::Patrons->new->empty; |
1215 |
my $empty = Koha::Patrons->new->empty; |
1216 |
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' ); |
1216 |
is( ref($empty), 'Koha::Patrons', '->empty returns a Koha::Patrons iterator' ); |
1217 |
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); |
1217 |
is( $empty->count, 0, 'The empty resultset is, well, empty :-D' ); |
1218 |
|
1218 |
|
|
|
1219 |
my $new_rs = $empty->search({ borrowernumber => $patron->borrowernumber }); |
1220 |
|
1221 |
is( $new_rs->count, 0, 'Further chaining an empty resultset, returns an empty resultset' ); |
1222 |
|
1219 |
throws_ok |
1223 |
throws_ok |
1220 |
{ Koha::Patrons->empty; } |
1224 |
{ Koha::Patrons->empty; } |
1221 |
'Koha::Exceptions::Object::NotInstantiated', |
1225 |
'Koha::Exceptions::Object::NotInstantiated', |
1222 |
- |
|
|