From b80599df98cc6e643b3e5a68e6532cc4559bda79 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 21 Dec 2021 10:16:55 -0300 Subject: [PATCH] Bug 29736: (QA follow-up) No need to delete all clubs There's no real need to delete all the existing clubs in the tests. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer --- t/db_dependent/Clubs.t | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/Clubs.t b/t/db_dependent/Clubs.t index 8d8a0d1951..853c988f8a 100755 --- a/t/db_dependent/Clubs.t +++ b/t/db_dependent/Clubs.t @@ -233,11 +233,10 @@ is( $club->club_enrollments->count, 1, 'There is 1 enrollment for club' ); $schema->storage->txn_rollback(); subtest 'filter_out_empty' => sub { - plan tests => 2; - $schema->storage->txn_begin(); + plan tests => 3; - Koha::Clubs->delete; + $schema->storage->txn_begin(); my $club_template = $builder->build_object({ class => 'Koha::Club::Templates' }); @@ -293,9 +292,14 @@ subtest 'filter_out_empty' => sub { $enrollment_2_1->cancel; - my $clubs = Koha::Clubs->search->filter_out_empty; - is( $clubs->count, 1, 'Only one club has patron enrolled' ); - is( $clubs->next->id, $club_1->id, 'Correct club is considered non-empty'); + my $clubs = Koha::Clubs->search({ club_template_id => $club_template->id }); + + is( $clubs->count, 3, 'Base resultset has all the clubs' ); + + my $filtered_out_rs = $clubs->filter_out_empty; + + is( $filtered_out_rs->count, 1, 'Only one club has patron enrolled' ); + is( $filtered_out_rs->next->id, $club_1->id, 'Correct club is considered non-empty'); $schema->storage->txn_rollback(); } -- 2.11.0