@@ -, +, @@ --- Koha/REST/Plugin/Objects.pm | 10 ------- t/db_dependent/Koha/REST/Plugin/Objects.t | 48 +------------------------------ 2 files changed, 1 insertion(+), 57 deletions(-) --- a/Koha/REST/Plugin/Objects.pm +++ a/Koha/REST/Plugin/Objects.pm @@ -95,16 +95,6 @@ sub register { $filtered_params = $c->build_query_params( $filtered_params, $reserved_params ); } - if ( defined $path_params ) { - - # Apply the mapping function to the passed params - $filtered_params //= {}; - $path_params = $result_set->attributes_from_api($path_params); - foreach my $param (keys %{$path_params}) { - $filtered_params->{$param} = $path_params->{$param}; - } - } - if( defined $reserved_params->{q} || defined $reserved_params->{query} || defined $reserved_params->{'x-koha-query'}) { $filtered_params //={}; my @query_params_array; --- a/t/db_dependent/Koha/REST/Plugin/Objects.t +++ a/t/db_dependent/Koha/REST/Plugin/Objects.t @@ -19,7 +19,6 @@ use Modern::Perl; use Koha::Acquisition::Orders; use Koha::Cities; -use Koha::Holds; use Koha::Biblios; # Dummy app for testing the plugin @@ -46,16 +45,6 @@ get '/orders' => sub { $c->render( status => 200, json => $orders ); }; -get '/patrons/:patron_id/holds' => sub { - my $c = shift; - my $params = $c->req->params->to_hash; - $params->{patron_id} = $c->stash("patron_id"); - $c->validation->output($params); - my $holds_set = Koha::Holds->new; - my $holds = $c->objects->search( $holds_set ); - $c->render( status => 200, json => {count => scalar(@$holds)} ); -}; - get '/biblios' => sub { my $c = shift; my $output = $c->req->params->to_hash; @@ -75,9 +64,8 @@ get '/biblios' => sub { $c->render( status => 200, json => {count => scalar(@$biblios), biblios => $biblios} ); }; - # The tests -use Test::More tests => 10; +use Test::More tests => 9; use Test::Mojo; use t::lib::Mocks; @@ -274,40 +262,6 @@ subtest 'objects.search helper, embed' => sub { $schema->storage->txn_rollback; }; -subtest 'objects.search helper, with path parameters and _match' => sub { - plan tests => 8; - - $schema->storage->txn_begin; - - Koha::Holds->search()->delete; - - my $patron = Koha::Patrons->find(10); - $patron->delete if $patron; - $patron = $builder->build_object( { class => "Koha::Patrons" } ); - $patron->borrowernumber(10)->store; - $builder->build_object( - { - class => "Koha::Holds", - value => { borrowernumber => $patron->borrowernumber } - } - ); - - my $t = Test::Mojo->new; - $t->get_ok('/patrons/1/holds?_match=exact') - ->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=exact'); - - $t->get_ok('/patrons/1/holds?_match=contains') - ->json_is('/count' => 0, 'there should be no holds for borrower 1 with _match=contains'); - - $t->get_ok('/patrons/10/holds?_match=exact') - ->json_is('/count' => 1, 'there should be 1 hold for borrower 10 with _match=exact'); - - $t->get_ok('/patrons/10/holds?_match=contains') - ->json_is('/count' => 1, 'there should be 1 hold for borrower 10 with _match=contains'); - - $schema->storage->txn_rollback; -}; - subtest 'object.search helper with query parameter' => sub { plan tests => 4; --