Bugzilla – Attachment 184160 Details for
Bug 40417
Search_rs is re-instating deleted query parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40417: Regression test
Bug-40417-Regression-test.patch (text/plain), 2.35 KB, created by
Matt Blenkinsop
on 2025-07-16 17:46:14 UTC
(
hide
)
Description:
Bug 40417: Regression test
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-07-16 17:46:14 UTC
Size:
2.35 KB
patch
obsolete
>From a12131ee69c16243f0cc7deadfbf04951d76aa4d Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Wed, 16 Jul 2025 17:55:43 +0100 >Subject: [PATCH] Bug 40417: Regression test > >--- > t/db_dependent/Koha/REST/Plugin/Objects.t | 46 ++++++++++++++++++++++- > 1 file changed, 45 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/REST/Plugin/Objects.t b/t/db_dependent/Koha/REST/Plugin/Objects.t >index bf5bbf0edb3..f89c7d62326 100755 >--- a/t/db_dependent/Koha/REST/Plugin/Objects.t >+++ b/t/db_dependent/Koha/REST/Plugin/Objects.t >@@ -53,6 +53,16 @@ get '/cities/rs' => sub { > $c->render( status => 200, json => { count => $cities->count } ); > }; > >+get '/cities/rs_regression' => sub { >+ my $c = shift; >+ $c->validation->output( $c->req->params->to_hash ); >+ $c->stash_embed; >+ $c->req->params->remove('q'); >+ my $cities = $c->objects->search_rs( Koha::Cities->new ); >+ >+ $c->render( status => 200, json => { count => $cities->count } ); >+}; >+ > get '/cities/:city_id' => sub { > my $c = shift; > my $id = $c->stash("city_id"); >@@ -135,7 +145,7 @@ get '/cities/:city_id/rs' => sub { > > # The tests > use Test::NoWarnings; >-use Test::More tests => 19; >+use Test::More tests => 20; > use Test::Mojo; > > use t::lib::Mocks; >@@ -991,3 +1001,37 @@ subtest 'date handling' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'Regression test - search_rs should not reinstate removed query parameters' => sub { >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ # Remove existing cities to have more control on the search results >+ Koha::Cities->delete; >+ >+ # Create three sample cities that match the query. We want to get all three returned when the city_name query parameter is removed >+ $builder->build_object( >+ { >+ class => 'Koha::Cities', >+ value => { city_name => 'city1' } >+ } >+ ); >+ $builder->build_object( >+ { >+ class => 'Koha::Cities', >+ value => { city_name => 'city2' } >+ } >+ ); >+ $builder->build_object( >+ { >+ class => 'Koha::Cities', >+ value => { city_name => 'city3' } >+ } >+ ); >+ my $t = Test::Mojo->new; >+ $t->get_ok('/cities/rs_regression?q={"city_name":"city1"}')->status_is(200)->json_is( '/count' => 3 ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40417
:
184155
|
184160
|
184161
|
184212
|
184213
|
184317
|
184318
|
184406
|
184407
|
184409
|
184410