From 1b0fd9580b3d7021a4b39210f25aad03de2f69f5 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 29 Mar 2018 13:34:25 -0300 Subject: [PATCH] Bug 20287: Fix tests expecting a warning The new Koha::Patron-based implementation encapsulates some error conditions that raised warnings and the tests expected that warning. Signed-off-by: Tomas Cohen Arazi Signed-off-by: Josef Moravec Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize --- t/db_dependent/api/v1/patrons.t | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/t/db_dependent/api/v1/patrons.t b/t/db_dependent/api/v1/patrons.t index ee41a21a1b..7c148011df 100644 --- a/t/db_dependent/api/v1/patrons.t +++ b/t/db_dependent/api/v1/patrons.t @@ -254,7 +254,7 @@ subtest 'update() tests' => sub { $schema->storage->txn_rollback; subtest 'librarian access tests' => sub { - plan tests => 23; + plan tests => 22; $schema->storage->txn_begin; @@ -284,11 +284,9 @@ subtest 'update() tests' => sub { $newpatron->{category_id} = $deleted_category_id; $tx = $t->ua->build_tx(PUT => "/api/v1/patrons/$patron_id_2" => json => $newpatron ); $tx->req->cookies({name => 'CGISESSID', value => $session_id}); - warning_like { - $t->request_ok($tx) - ->status_is(400) - ->json_is('/error' => "Given category_id does not exist"); } - qr/^DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails/; + $t->request_ok($tx) + ->status_is(400) + ->json_is('/error' => "Given category_id does not exist"); $newpatron->{category_id} = $patron_2->categorycode; # Create a library just to make sure its ID doesn't exist on the DB -- 2.11.0