View | Details | Raw Unified | Return to bug 24432
Collapse All | Expand All

(-)a/t/Koha/REST/Plugin/Query.t (-2 / +24 lines)
Lines 22-27 use Mojolicious::Lite; Link Here
22
use Try::Tiny;
22
use Try::Tiny;
23
23
24
use Koha::Cities;
24
use Koha::Cities;
25
use Koha::Holds;
25
26
26
app->log->level('error');
27
app->log->level('error');
27
28
Lines 108-113 get '/dbic_merge_sorting_result_set' => sub { Link Here
108
    $c->render( json => $attributes, status => 200 );
109
    $c->render( json => $attributes, status => 200 );
109
};
110
};
110
111
112
get '/dbic_merge_sorting_date' => sub {
113
    my $c = shift;
114
    my $attributes = { a => 'a', b => 'b' };
115
    my $result_set = Koha::Holds->new;
116
    $attributes = $c->dbic_merge_sorting(
117
        {
118
            attributes => $attributes,
119
            params     => { _match => 'exact', _order_by => [ '-hold_date' ] },
120
            result_set => $result_set
121
        }
122
    );
123
    $c->render( json => $attributes, status => 200 );
124
};
125
111
get '/build_query' => sub {
126
get '/build_query' => sub {
112
    my $c = shift;
127
    my $c = shift;
113
    my ( $filtered_params, $reserved_params ) =
128
    my ( $filtered_params, $reserved_params ) =
Lines 214-220 subtest 'extract_reserved_params() tests' => sub { Link Here
214
229
215
subtest 'dbic_merge_sorting() tests' => sub {
230
subtest 'dbic_merge_sorting() tests' => sub {
216
231
217
    plan tests => 15;
232
    plan tests => 20;
218
233
219
    my $t = Test::Mojo->new;
234
    my $t = Test::Mojo->new;
220
235
Lines 240-245 subtest 'dbic_merge_sorting() tests' => sub { Link Here
240
        ]
255
        ]
241
      );
256
      );
242
257
258
    $t->get_ok('/dbic_merge_sorting_date')->status_is(200)
259
      ->json_is( '/a' => 'a', 'Existing values are kept (a)' )
260
      ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is(
261
        '/order_by' => [
262
            { -desc => 'reservedate' }
263
        ]
264
      );
265
243
    $t->get_ok('/dbic_merge_sorting_single')->status_is(200)
266
    $t->get_ok('/dbic_merge_sorting_single')->status_is(200)
244
      ->json_is( '/a' => 'a', 'Existing values are kept (a)' )
267
      ->json_is( '/a' => 'a', 'Existing values are kept (a)' )
245
      ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is(
268
      ->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is(
246
- 

Return to bug 24432