Lines 233-243
is( $club->club_enrollments->count, 1, 'There is 1 enrollment for club' );
Link Here
|
233 |
$schema->storage->txn_rollback(); |
233 |
$schema->storage->txn_rollback(); |
234 |
|
234 |
|
235 |
subtest 'filter_out_empty' => sub { |
235 |
subtest 'filter_out_empty' => sub { |
236 |
plan tests => 2; |
|
|
237 |
|
236 |
|
238 |
$schema->storage->txn_begin(); |
237 |
plan tests => 3; |
239 |
|
238 |
|
240 |
Koha::Clubs->delete; |
239 |
$schema->storage->txn_begin(); |
241 |
|
240 |
|
242 |
my $club_template = $builder->build_object({ class => 'Koha::Club::Templates' }); |
241 |
my $club_template = $builder->build_object({ class => 'Koha::Club::Templates' }); |
243 |
|
242 |
|
Lines 293-301
subtest 'filter_out_empty' => sub {
Link Here
|
293 |
|
292 |
|
294 |
$enrollment_2_1->cancel; |
293 |
$enrollment_2_1->cancel; |
295 |
|
294 |
|
296 |
my $clubs = Koha::Clubs->search->filter_out_empty; |
295 |
my $clubs = Koha::Clubs->search({ club_template_id => $club_template->id }); |
297 |
is( $clubs->count, 1, 'Only one club has patron enrolled' ); |
296 |
|
298 |
is( $clubs->next->id, $club_1->id, 'Correct club is considered non-empty'); |
297 |
is( $clubs->count, 3, 'Base resultset has all the clubs' ); |
|
|
298 |
|
299 |
my $filtered_out_rs = $clubs->filter_out_empty; |
300 |
|
301 |
is( $filtered_out_rs->count, 1, 'Only one club has patron enrolled' ); |
302 |
is( $filtered_out_rs->next->id, $club_1->id, 'Correct club is considered non-empty'); |
299 |
|
303 |
|
300 |
$schema->storage->txn_rollback(); |
304 |
$schema->storage->txn_rollback(); |
301 |
} |
305 |
} |
302 |
- |
|
|