From 6709a7885c26f91e4582af3c17888fa6468bdf69 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 Content-Type: text/plain; charset=utf-8 Signed-off-by: Marcel de Rooy [EDIT] Changed 'is' to 'like' with regex since we also have the db name. --- 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..2a54225c97 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' ); + like( $_->property, qr/borrowers\W?\.\W?lastseen/, 'Column should be the expected one' ); # optional \W for quote or backtic + is( $_->value, 'wrong_value', 'Value should be the expected one' ); + }; $schema->storage->dbh->{PrintError} = $print_error; }; -- 2.11.0