Bugzilla – Attachment 117034 Details for
Bug 27715
Possibly SQL injection in virtualshelves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27715: Add tests
Bug-27715-Add-tests.patch (text/plain), 2.56 KB, created by
Martin Renvoize (ashimema)
on 2021-02-19 09:11:39 UTC
(
hide
)
Description:
Bug 27715: Add tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-02-19 09:11:39 UTC
Size:
2.56 KB
patch
obsolete
>From f7b4db15e54fafa01c845b6fa7a10761210533e4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 18 Feb 2021 15:42:48 +0100 >Subject: [PATCH] Bug 27715: Add tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Utils/Datatables.t | 61 +++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) > create mode 100644 t/db_dependent/Utils/Datatables.t > >diff --git a/t/db_dependent/Utils/Datatables.t b/t/db_dependent/Utils/Datatables.t >new file mode 100644 >index 0000000000..9f52ce3508 >--- /dev/null >+++ b/t/db_dependent/Utils/Datatables.t >@@ -0,0 +1,61 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 1; >+ >+use C4::Utils::DataTables; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+ >+use Koha::Database; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+ >+subtest 'dt_build_orderby' => sub { >+ plan tests => 2; >+ >+ my $dt_params = { >+ iSortCol_0 => 5, >+ sSortDir_0 => "asc", >+ mDataProp_5 => "branch", >+ name_sorton => "borrowers.surname borrowers.firstname", >+ >+ iSortCol_1 => 2, >+ sSortDir_1 => "desc", >+ mDataProp_2 => "name", >+ branch_sorton => "branches.branchname", >+ }; >+ >+ my $orderby = dt_build_orderby($dt_params); >+ is( $orderby, " ORDER BY branches.branchname asc,borrowers.surname desc,borrowers.firstname desc ", 'ORDER BY has been correctly built' ); >+ >+ $dt_params = { >+ %$dt_params, >+ iSortCol_2 => 3, >+ sSortDir_2 => "asc", >+ mDataProp_3 => "branch,somethingelse", >+ }; >+ >+ $orderby = dt_build_orderby($dt_params); >+ is( $orderby, " ORDER BY branches.branchname asc,borrowers.surname desc,borrowers.firstname desc ", 'ORDER BY has been correctly built, even with invalid stuff'); >+}; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27715
:
116992
|
116993
|
116994
|
116995
|
116998
|
117027
|
117028
|
117029
|
117030
|
117031
|
117032
|
117033
|
117034
|
117035
|
117036
|
117068
|
117069
|
117070
|
117071
|
117072
|
117073
|
117074
|
117076
|
117077
|
117078
|
117079
|
117080
|
117081
|
117082
|
117112
|
117113
|
117114
|
117115
|
117116
|
117117
|
117118