From c6e24cddd0f3cce680a90090b5a8d2374cf10f30 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 24 Oct 2019 12:51:19 +0200 Subject: [PATCH] Bug 23825: Add tests --- t/db_dependent/Koha/Object.t | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t index 7570b62afe..29519f1c5e 100755 --- a/t/db_dependent/Koha/Object.t +++ b/t/db_dependent/Koha/Object.t @@ -399,17 +399,20 @@ subtest 'store() tests' => sub { subtest 'Bad value tests' => sub { - plan tests => 1; + plan tests => 3; my $patron = $builder->build_object({ class => 'Koha::Patrons' }); my $print_error = $schema->storage->dbh->{PrintError}; $schema->storage->dbh->{PrintError} = 0; - throws_ok - { $patron->lastseen('wrong_value')->store; } - 'Koha::Exceptions::Object::BadValue', - 'Exception thrown correctly'; + try { + $patron->lastseen('wrong_value')->store; + } catch { + ok( $_->isa('Koha::Exceptions::Object::BadValue'), 'Exception thrown correctly' ); + is( $_->property, 'borrowers.lastseen', 'Column should be the expected one' ); + is( $_->value, 'wrong_value', 'Value should be the expected one' ); + }; $schema->storage->dbh->{PrintError} = $print_error; }; -- 2.11.0