Bugzilla – Attachment 67782 Details for
Bug 19370
Add a helper function for translating order_by params into SQL::Abstract
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19370: Unit tests
Bug-19370-Unit-tests.patch (text/plain), 1.53 KB, created by
Lari Taskula
on 2017-10-07 12:43:23 UTC
(
hide
)
Description:
Bug 19370: Unit tests
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2017-10-07 12:43:23 UTC
Size:
1.53 KB
patch
obsolete
>From 4955654d7914b7a8f23d156e23df12a3f2767c27 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 26 Sep 2017 15:17:01 -0300 >Subject: [PATCH] Bug 19370: Unit tests > >Signed-off-by: Lari Taskula <lari.taskula@jns.fi> >--- > t/Koha/REST/Plugin/Query.t | 27 ++++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > >diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t >index 8270dc0..2851962 100644 >--- a/t/Koha/REST/Plugin/Query.t >+++ b/t/Koha/REST/Plugin/Query.t >@@ -67,9 +67,21 @@ get '/query_full' => sub { > ); > }; > >+get '/dbic_merge_sorting' => sub { >+ my $c = shift; >+ my $attributes = { a => 'a', b => 'b' }; >+ $attributes = $c->dbic_merge_sorting( >+ { >+ attributes => $attributes, >+ params => { _match => 'exact', _order_by => 'uno|-dos|+tres' } >+ } >+ ); >+ $c->render( json => $attributes, status => 200 ); >+}; >+ > # The tests > >-use Test::More tests => 1; >+use Test::More tests => 2; > use Test::Mojo; > > subtest 'extract_reserved_params() tests' => sub { >@@ -98,3 +110,16 @@ subtest 'extract_reserved_params() tests' => sub { > } ); > > }; >+ >+subtest 'dbic_merge_sorting() tests' => sub { >+ >+ plan tests => 5; >+ >+ my $t = Test::Mojo->new; >+ >+ $t->get_ok('/dbic_merge_sorting') >+ ->status_is(200) >+ ->json_is( '/a' => 'a', 'Existing values are kept (a)' ) >+ ->json_is( '/b' => 'b', 'Existing values are kept (b)' ) >+ ->json_is( '/order_by' => [ 'uno', { -desc => 'dos' }, { -asc => 'tres' } ] ); >+}; >-- >2.7.4
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 19370
:
67379
|
67380
|
67402
|
67403
|
67525
|
67576
|
67782
|
67783
|
67784
|
69304
|
69305
|
69307
|
69383
|
69384
|
69391
|
69392
|
69393
|
69394