From 3e6ad3402e9cabf43ab1535226a6681d001af903 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 2 Feb 2021 16:28:07 -0300 Subject: [PATCH] Bug 26636: Regression tests for undef case This patch adds tests for the case in which there's no object identified by the supplied $id. It should return undef. Sponsored-by: Virginia Polytechnic Institute and State University Signed-off-by: Tomas Cohen Arazi Signed-off-by: Andrew Fuerste-Henry --- t/db_dependent/Koha/REST/Plugin/Objects.t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/REST/Plugin/Objects.t b/t/db_dependent/Koha/REST/Plugin/Objects.t index c8af770a80..afdc24da3e 100755 --- a/t/db_dependent/Koha/REST/Plugin/Objects.t +++ b/t/db_dependent/Koha/REST/Plugin/Objects.t @@ -434,7 +434,7 @@ subtest 'object.search helper order by embedded columns' => sub { subtest 'objects.find helper' => sub { - plan tests => 6; + plan tests => 9; my $t = Test::Mojo->new; @@ -451,6 +451,13 @@ subtest 'objects.find helper' => sub { ->status_is(200) ->json_is( $city_2->to_api ); + # Remove the city + my $city_2_id = $city_2->id; + $city_2->delete; + $t->get_ok( '/cities/' . $city_2_id ) + ->status_is(200) + ->json_is( undef ); + $schema->storage->txn_rollback; }; -- 2.25.0