From 00088e754f8de3c1bdabc1a2f9905ca615015b67 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 16 Jul 2025 23:31:45 -0300 Subject: [PATCH] Bug 40423: Unit tests --- t/Koha/REST/Plugin/Query.t | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/t/Koha/REST/Plugin/Query.t b/t/Koha/REST/Plugin/Query.t index 057314914fa..23f63d3d697 100755 --- a/t/Koha/REST/Plugin/Query.t +++ b/t/Koha/REST/Plugin/Query.t @@ -294,6 +294,18 @@ get '/stash_overrides' => sub { ); }; +get '/stash_request_id' => sub { + my $c = shift; + + $c->stash_request_id(); + my $request_id = $c->stash('koha.request_id'); + + $c->render( + status => 200, + json => $request_id + ); +}; + get '/dbic_extended_attributes_join' => sub { my ( $c, $args ) = @_; @@ -370,7 +382,7 @@ sub to_model { # The tests use Test::NoWarnings; -use Test::More tests => 11; +use Test::More tests => 12; use Test::Mojo; subtest 'extract_reserved_params() tests' => sub { @@ -589,6 +601,20 @@ subtest 'stash_overrides() tests' => sub { }; +subtest 'stash_request_id() tests' => sub { + + plan tests => 6; + + my $t = Test::Mojo->new; + + $t->get_ok( '/stash_request_id' => { 'x-koha-request-id' => '123456789' } )->json_is('123456789'); + + $t->get_ok( '/stash_request_id' => { 'x-koha-request-id' => '' } )->json_is(q{}); + + $t->get_ok( '/stash_request_id' => {} )->json_is(q{}); + +}; + subtest 'dbic_extended_attributes_join() tests' => sub { plan tests => 4; -- 2.50.1