From f001df918a6122dc3c1d3f1dc5b8d3753c8cbd4d Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 25 Jun 2020 10:38:16 +0000 Subject: [PATCH] Bug 25875: Unit test --- t/db_dependent/Utils/Datatables_Members.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Utils/Datatables_Members.t b/t/db_dependent/Utils/Datatables_Members.t index e0632c4a2f..781b02384a 100644 --- a/t/db_dependent/Utils/Datatables_Members.t +++ b/t/db_dependent/Utils/Datatables_Members.t @@ -501,7 +501,7 @@ subtest 'Search by any borrowers field (bug 17374)' => sub { }; subtest 'Search with permissions' => sub { - plan tests => 2; + plan tests => 4; my $superlibrarian = $builder->build_object( { @@ -549,6 +549,26 @@ subtest 'Search with permissions' => sub { ], 'We got the 3 patrons we expected' ); + + C4::Context->dbh->do( + q|INSERT INTO user_permissions(borrowernumber, module_bit, code) VALUES(?,?,?)|, + undef, + $librarian_with_subpermission->borrowernumber, + 1, + 'force_checkout' + ); + is( $search_results->{iTotalDisplayRecords}, + 3, "We find 3 patrons with suggestions_manage permission" ); + is_deeply( + [ sort map { $_->{borrowernumber} } @{ $search_results->{patrons} } ], + [ + $superlibrarian->borrowernumber, + $librarian_with_full_permission->borrowernumber, + $librarian_with_subpermission->borrowernumber + ], + 'We got the 3 patrons we expected' + ); + }; subtest 'return values' => sub { -- 2.11.0