Bug 26984: (follow-up) Don't delete patrons and checkouts in Objects.t

Rather than counting all and assuriing we get 10, we can count all, add 10, and ensure the numbers still match

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 59e4b03d73)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2020-11-17 12:11:21 +00:00 committed by Andrew Fuerste-Henry
parent 5685d33d03
commit 06968cb76f
1 changed files with 4 additions and 6 deletions

View File

@ -261,18 +261,16 @@ subtest '->is_paged and ->pager tests' => sub {
$schema->storage->txn_begin;
# Delete existing patrons
t::lib::Mocks::mock_preference('AnonymousPatron', '');
Koha::Checkouts->delete;
Koha::Patrons->delete;
# Create 10 patrons
# Count existing patrons
my $nb_patrons = Koha::Patrons->search()->count;
# Create 10 more patrons
foreach (1..10) {
$builder->build_object({ class => 'Koha::Patrons' });
}
# Non-paginated search
my $patrons = Koha::Patrons->search();
is( $patrons->count, 10, 'Search returns all patrons' );
is( $patrons->count, $nb_patrons + 10, 'Search returns all patrons' );
ok( !$patrons->is_paged, 'Search is not paged' );
# Paginated search