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

(-)a/t/db_dependent/Koha/REST/Plugin/Objects.t (-2 / +25 lines)
Lines 19-24 use Modern::Perl; Link Here
19
19
20
use Koha::Acquisition::Orders;
20
use Koha::Acquisition::Orders;
21
use Koha::Cities;
21
use Koha::Cities;
22
use Koha::Holds;
22
23
23
# Dummy app for testing the plugin
24
# Dummy app for testing the plugin
24
use Mojolicious::Lite;
25
use Mojolicious::Lite;
Lines 44-51 get '/orders' => sub { Link Here
44
    $c->render( status => 200, json => $orders );
45
    $c->render( status => 200, json => $orders );
45
};
46
};
46
47
48
get '/patrons/:patron_id/holds' => sub {
49
    my $c = shift;
50
    $c->validation->output($c->req->params->to_hash);
51
    my $holds_set = Koha::Holds->new;
52
    my $holds     = $c->objects->search( $holds_set );
53
    $c->render( status => 200, json => {count => scalar(@$holds)} );
54
};
55
47
# The tests
56
# The tests
48
use Test::More tests => 3;
57
use Test::More tests => 4;
49
use Test::Mojo;
58
use Test::Mojo;
50
59
51
use t::lib::TestBuilder;
60
use t::lib::TestBuilder;
Lines 176-178 subtest 'objects.search helper, embed' => sub { Link Here
176
185
177
    $schema->storage->txn_rollback;
186
    $schema->storage->txn_rollback;
178
};
187
};
179
- 
188
189
subtest 'objects.search helper, with path parameters and _match' => sub {
190
    plan tests => 2;
191
192
    $schema->storage->txn_begin;
193
194
    Koha::Holds->search()->delete;
195
196
    $builder->build_object({class=>"Koha::Holds", value => {borrowernumber => 10 }});
197
198
    $t->get_ok('/patrons/1/holds?_match=contains')
199
      ->json_is('/count' => 0, 'there should be no holds for borrower 1');
200
201
    $schema->storage->txn_rollback;
202
};

Return to bug 24487