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

(-)a/t/Koha/REST/Plugin/Query.t (-4 / +60 lines)
Lines 24-29 use Try::Tiny; Link Here
24
use Koha::Cities;
24
use Koha::Cities;
25
use Koha::Holds;
25
use Koha::Holds;
26
use Koha::Biblios;
26
use Koha::Biblios;
27
use Koha::Patron::Relationship;
27
28
28
app->log->level('error');
29
app->log->level('error');
29
30
Lines 135-140 get '/dbic_merge_prefetch' => sub { Link Here
135
    $c->render( json => $attributes, status => 200 );
136
    $c->render( json => $attributes, status => 200 );
136
};
137
};
137
138
139
get '/dbic_merge_prefetch_recursive' => sub {
140
    my $c = shift;
141
    my $attributes = {};
142
    my $result_set = Koha::Patron::Relationship->new;
143
    $c->stash('koha.embed', {
144
      "guarantee" => {
145
        "children" => {
146
          "article_requests" => {},
147
          "housebound_profile" => {
148
            "children" => {
149
              "housebound_visits" => {}
150
            }
151
          },
152
          "housebound_role" => {}
153
        }
154
      }
155
    });
156
157
    $c->dbic_merge_prefetch({
158
        attributes => $attributes,
159
        result_set => $result_set
160
    });
161
162
    $c->render( json => $attributes, status => 200 );
163
};
164
165
get '/dbic_merge_prefetch_count' => sub {
166
    my $c = shift;
167
    my $attributes = {};
168
    my $result_set = Koha::Patron::Relationship->new;
169
    $c->stash('koha.embed', {
170
            "guarantee_count" => {
171
              "is_count" => 1
172
            }
173
        });
174
175
    $c->dbic_merge_prefetch({
176
        attributes => $attributes,
177
        result_set => $result_set
178
    });
179
180
    $c->render( json => $attributes, status => 200 );
181
};
182
138
get '/merge_q_params' => sub {
183
get '/merge_q_params' => sub {
139
  my $c = shift;
184
  my $c = shift;
140
  my $filtered_params = {'biblio_id' => 1};
185
  my $filtered_params = {'biblio_id' => 1};
Lines 298-310 subtest 'dbic_merge_sorting() tests' => sub { Link Here
298
};
343
};
299
344
300
subtest '/dbic_merge_prefetch' => sub {
345
subtest '/dbic_merge_prefetch' => sub {
301
    plan tests => 4;
346
    plan tests => 10;
302
347
303
    my $t = Test::Mojo->new;
348
    my $t = Test::Mojo->new;
304
349
305
    $t->get_ok('/dbic_merge_prefetch')->status_is(200)
350
    $t->get_ok('/dbic_merge_prefetch')->status_is(200)
306
      ->json_like( '/prefetch/0' => qr/item|biblio/ )
351
      ->json_is( '/prefetch/0' => 'biblio' )
307
      ->json_like( '/prefetch/1' => qr/item|biblio/ );
352
      ->json_is( '/prefetch/1' => 'item' );
353
354
    $t->get_ok('/dbic_merge_prefetch_recursive')->status_is(200)
355
      ->json_is('/prefetch/0' => {
356
        guarantee => [
357
          'article_requests',
358
          {housebound_profile => 'housebound_visits'},
359
          'housebound_role'
360
        ]
361
      });
362
363
    $t->get_ok('/dbic_merge_prefetch_count')->status_is(200)
364
      ->json_is('/prefetch/0' => 'guarantee');
308
};
365
};
309
366
310
subtest '/merge_q_params' => sub {
367
subtest '/merge_q_params' => sub {
311
- 

Return to bug 24830