From 816943f41209b6b2328f032a527b2ba977d68795 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 27 May 2016 14:02:42 +0200 Subject: [PATCH] Bug 16609: Catch warning from Koha::Hold in Hold.t Before this patch, the suspend step triggers a warn from Koha::Hold. Now we catch it. Test plan: Run the test. Do not see the warning about unable to suspend. Signed-off-by: Marcel de Rooy NOTE: Nice clean up! Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart --- t/db_dependent/Hold.t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Hold.t b/t/db_dependent/Hold.t index 204d60e..9604bd8 100755 --- a/t/db_dependent/Hold.t +++ b/t/db_dependent/Hold.t @@ -27,7 +27,8 @@ use Koha::Item; use Koha::DateUtils; use t::lib::TestBuilder; -use Test::More tests => 31; +use Test::More tests => 32; +use Test::Warn; use_ok('Koha::Hold'); @@ -86,7 +87,8 @@ $hold->resume(); is( $hold->suspend, 0, "Hold is not suspended" ); is( $hold->suspend_until, undef, "Hold no longer has suspend_until date" ); $hold->found('W'); -$hold->suspend_hold(); +warning_like { $hold->suspend_hold } + qr/Unable to suspend waiting hold!/, 'Catch warn about failed suspend'; is( $hold->suspend, 0, "Waiting hold cannot be suspended" ); $item = $hold->item(); -- 2.8.1