From 457c4bf13613801a8652ff7f2a2a2a2123fd7e01 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 27 Mar 2019 09:31:59 +0000 Subject: [PATCH] Bug 22577: Add test for Koha::Patrons->search --- t/db_dependent/Koha/Patrons.t | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index a0a46ec2eb..8cff118472 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 33; +use Test::More tests => 34; use Test::Warn; use Test::Exception; use Test::MockModule; @@ -368,8 +368,18 @@ subtest "move_to_deleted" => sub { $retrieved_patron->delete( $patron->{borrowernumber} ); # Cleanup }; -subtest "delete" => sub { - plan tests => 5; +subtest "Koha::Patrons->search" => sub { + plan tests => 1; + + my $set = Koha::Patrons->search(); + my $count = $set->count; + my $reduced_set = $set->search({ borrowernumber => { '>' => 0 } }); + my $reduced_count = $reduced_set->count; + is ( $count, $reduced_count, "System users not found in Koha::Patrons->search"); +}; + +subtest "Koha::Patron->delete" => sub { + plan tests => 6; t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); my $patron = $builder->build( { source => 'Borrower' } ); my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); -- 2.20.1