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 <tomascohen@theke.io>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d4c628f171)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
(cherry picked from commit 4e4a452609)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Tomas Cohen Arazi 2021-12-21 10:16:55 -03:00 committed by Victor Grousset/tuxayo
parent 24991fed04
commit cdca6f73d5
1 changed files with 10 additions and 6 deletions

View File

@ -233,12 +233,11 @@ is( $club->club_enrollments->count, 1, 'There is 1 enrollment for club' );
$schema->storage->txn_rollback();
subtest 'filter_out_empty' => sub {
plan tests => 2;
plan tests => 3;
$schema->storage->txn_begin();
Koha::Clubs->delete;
my $club_template = $builder->build_object({ class => 'Koha::Club::Templates' });
# club_1 has 2 patrons
@ -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();
}