Bug 24432: Regresion test
To test: 1. apply this patch 2. prove t/Koha/REST/Plugin/Query.t Test should fail at this point. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
7015ba7059
commit
d8bd366b5c
1 changed files with 24 additions and 1 deletions
|
@ -22,6 +22,7 @@ use Mojolicious::Lite;
|
|||
use Try::Tiny;
|
||||
|
||||
use Koha::Cities;
|
||||
use Koha::Holds;
|
||||
|
||||
app->log->level('error');
|
||||
|
||||
|
@ -108,6 +109,20 @@ get '/dbic_merge_sorting_result_set' => sub {
|
|||
$c->render( json => $attributes, status => 200 );
|
||||
};
|
||||
|
||||
get '/dbic_merge_sorting_date' => sub {
|
||||
my $c = shift;
|
||||
my $attributes = { a => 'a', b => 'b' };
|
||||
my $result_set = Koha::Holds->new;
|
||||
$attributes = $c->dbic_merge_sorting(
|
||||
{
|
||||
attributes => $attributes,
|
||||
params => { _match => 'exact', _order_by => [ '-hold_date' ] },
|
||||
result_set => $result_set
|
||||
}
|
||||
);
|
||||
$c->render( json => $attributes, status => 200 );
|
||||
};
|
||||
|
||||
get '/build_query' => sub {
|
||||
my $c = shift;
|
||||
my ( $filtered_params, $reserved_params ) =
|
||||
|
@ -214,7 +229,7 @@ subtest 'extract_reserved_params() tests' => sub {
|
|||
|
||||
subtest 'dbic_merge_sorting() tests' => sub {
|
||||
|
||||
plan tests => 15;
|
||||
plan tests => 20;
|
||||
|
||||
my $t = Test::Mojo->new;
|
||||
|
||||
|
@ -240,6 +255,14 @@ subtest 'dbic_merge_sorting() tests' => sub {
|
|||
]
|
||||
);
|
||||
|
||||
$t->get_ok('/dbic_merge_sorting_date')->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' => [
|
||||
{ -desc => 'reservedate' }
|
||||
]
|
||||
);
|
||||
|
||||
$t->get_ok('/dbic_merge_sorting_single')->status_is(200)
|
||||
->json_is( '/a' => 'a', 'Existing values are kept (a)' )
|
||||
->json_is( '/b' => 'b', 'Existing values are kept (b)' )->json_is(
|
||||
|
|
Loading…
Reference in a new issue