From 3f957403505b6570ccb2cde7ceea00a2c57e2694 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Mon, 30 Mar 2015 09:04:41 -0400 Subject: [PATCH] Bug 13928: Clean up noisy t/Borrower.t tests While testing bug 13882, noisy messages were noticed. Also, Test::Warn was used, but no catching attempts were made. This patch solves that problem. TEST PLAN --------- 1) prove -v t/Borrowers.t -- There should be three noisy lines. 2) apply patch 3) prove -v t/Borrowers.t -- There will be 3 more tests and no noisy lines. 4) Run koha qa test tool -- There should be no issues. NOTE: This will conflict with bug 13882 if either gets pushed to master, but fixing the conflict should be easy enough. --- t/Borrower.t | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/t/Borrower.t b/t/Borrower.t index 8da4d88..2118d59 100755 --- a/t/Borrower.t +++ b/t/Borrower.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 13; +use Test::More tests => 16; use Test::Warn; use Koha::Database; @@ -46,11 +46,13 @@ ok( ref($ret) eq 'Koha::Borrower', "Set returns object on success" ); is( $object2->surname(), "Test Borrower Surname 3", "Set sets first field correctly" ); is( $object2->firstname(), "Test Firstname", "Set sets second field correctly" ); -$ret = $object->set({ surname => "Test Borrower Surname 4", bork => "bork" }); +warning_is { $ret = $object->set({ surname => "Test Borrower Surname 4", bork => "bork" }) } "No property bork!", "Expected 'No property bork!' caught"; is( $object2->surname(), "Test Borrower Surname 3", "Bad Set does not set field" ); is( $ret, 0, "Set returns 0 when passed a bad property" ); -ok( ! defined $object->bork(), 'Bad getter returns undef' ); -ok( ! defined $object->bork('bork'), 'Bad setter returns undef' ); +warning_is { $ret = $object->bork() } 'No method bork!', "Expected 'No method bork!' caught for getter."; +ok( ! defined $ret, 'Bad getter returns undef' ); +warning_is { $ret = $object->bork('bork') } 'No method bork!', "Expected 'No method bork!' caught for setter."; +ok( ! defined $ret, 'Bad setter returns undef' ); 1; -- 1.9.1