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

(-)a/t/Koha/REST/Plugin/Query.t (-2 / +26 lines)
Lines 67-75 get '/query_full' => sub { Link Here
67
    );
67
    );
68
};
68
};
69
69
70
get '/dbic_merge_sorting' => sub {
71
    my $c = shift;
72
    my $attributes = { a => 'a', b => 'b' };
73
    $attributes = $c->dbic_merge_sorting(
74
        {
75
            attributes => $attributes,
76
            params     => { _match => 'exact', _order_by => 'uno|-dos|+tres' }
77
        }
78
    );
79
    $c->render( json => $attributes, status => 200 );
80
};
81
70
# The tests
82
# The tests
71
83
72
use Test::More tests => 1;
84
use Test::More tests => 2;
73
use Test::Mojo;
85
use Test::Mojo;
74
86
75
subtest 'extract_reserved_params() tests' => sub {
87
subtest 'extract_reserved_params() tests' => sub {
Lines 98-100 subtest 'extract_reserved_params() tests' => sub { Link Here
98
        } );
110
        } );
99
111
100
};
112
};
101
- 
113
114
subtest 'dbic_merge_sorting() tests' => sub {
115
116
    plan tests => 5;
117
118
    my $t = Test::Mojo->new;
119
120
    $t->get_ok('/dbic_merge_sorting')
121
      ->status_is(200)
122
      ->json_is( '/a' => 'a', 'Existing values are kept (a)' )
123
      ->json_is( '/b' => 'b', 'Existing values are kept (b)' )
124
      ->json_is( '/order_by' => [ 'uno', { -desc => 'dos' }, { -asc => 'tres' } ] );
125
};

Return to bug 19370