From 849a16dfcce1508ce89e20e5332c4808b2f7691f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 31 Aug 2023 09:03:31 +0200 Subject: [PATCH] Bug 34609: Add missing test for Koha::Hold->biblio Signed-off-by: Jonathan Druart --- t/db_dependent/Koha/Hold.t | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t index 5fc1646d35a..cc90dafb899 100755 --- a/t/db_dependent/Koha/Hold.t +++ b/t/db_dependent/Koha/Hold.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 11; +use Test::More tests => 12; use Test::Exception; use Test::MockModule; @@ -67,6 +67,26 @@ subtest 'store() tests' => sub { $schema->storage->txn_rollback; }; +subtest 'biblio() tests' => sub { + + plan tests => 1; + + $schema->storage->txn_begin; + + my $hold = $builder->build_object( + { + class => 'Koha::Holds', + } + ); + + local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /cannot be null/ }; + throws_ok { $hold->biblionumber(undef)->store; } + 'DBIx::Class::Exception', + 'reserves.biblionumber cannot be null, exception thrown'; + + $schema->storage->txn_rollback; +}; + subtest 'fill() tests' => sub { plan tests => 14; -- 2.25.1