|
Lines 108-113
get '/dbic_merge_sorting_result_set' => sub {
Link Here
|
| 108 |
$c->render( json => $attributes, status => 200 ); |
108 |
$c->render( json => $attributes, status => 200 ); |
| 109 |
}; |
109 |
}; |
| 110 |
|
110 |
|
|
|
111 |
get '/dbic_merge_sorting_date' => sub { |
| 112 |
my $c = shift; |
| 113 |
my $attributes = { a => 'a', b => 'b' }; |
| 114 |
my $result_set = Koha::Holds->new; |
| 115 |
$attributes = $c->dbic_merge_sorting( |
| 116 |
{ |
| 117 |
attributes => $attributes, |
| 118 |
params => { _match => 'exact', _order_by => [ '-hold_date' ] }, |
| 119 |
result_set => $result_set |
| 120 |
} |
| 121 |
); |
| 122 |
$c->render( json => $attributes, status => 200 ); |
| 123 |
}; |
| 124 |
|
| 111 |
get '/build_query' => sub { |
125 |
get '/build_query' => sub { |
| 112 |
my $c = shift; |
126 |
my $c = shift; |
| 113 |
my ( $filtered_params, $reserved_params ) = |
127 |
my ( $filtered_params, $reserved_params ) = |
|
Lines 214-220
subtest 'extract_reserved_params() tests' => sub {
Link Here
|
| 214 |
|
228 |
|
| 215 |
subtest 'dbic_merge_sorting() tests' => sub { |
229 |
subtest 'dbic_merge_sorting() tests' => sub { |
| 216 |
|
230 |
|
| 217 |
plan tests => 15; |
231 |
plan tests => 20; |
| 218 |
|
232 |
|
| 219 |
my $t = Test::Mojo->new; |
233 |
my $t = Test::Mojo->new; |
| 220 |
|
234 |
|
|
Lines 240-245
subtest 'dbic_merge_sorting() tests' => sub {
Link Here
|
| 240 |
] |
254 |
] |
| 241 |
); |
255 |
); |
| 242 |
|
256 |
|
|
|
257 |
$t->get_ok('/dbic_merge_sorting_date')->status_is(200) |
| 258 |
->json_is( '/a' => 'a', 'Existing values are kept (a)' ) |
| 259 |
->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( |
| 260 |
'/order_by' => [ |
| 261 |
{ -desc => 'hold_date' } |
| 262 |
] |
| 263 |
); |
| 264 |
|
| 243 |
$t->get_ok('/dbic_merge_sorting_single')->status_is(200) |
265 |
$t->get_ok('/dbic_merge_sorting_single')->status_is(200) |
| 244 |
->json_is( '/a' => 'a', 'Existing values are kept (a)' ) |
266 |
->json_is( '/a' => 'a', 'Existing values are kept (a)' ) |
| 245 |
->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( |
267 |
->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is( |
| 246 |
- |
|
|