Bugzilla – Attachment 184077 Details for
Bug 40374
Koha/Booking.t generates warnings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40374: Remove warnings from Koha/Booking.t
Bug-40374-Remove-warnings-from-KohaBookingt.patch (text/plain), 2.86 KB, created by
Jonathan Druart
on 2025-07-15 09:43:50 UTC
(
hide
)
Description:
Bug 40374: Remove warnings from Koha/Booking.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-15 09:43:50 UTC
Size:
2.86 KB
patch
obsolete
>From 01d9ba50404630b09912fcbd32f5c89e019da9c9 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 15 Jul 2025 11:43:33 +0200 >Subject: [PATCH] Bug 40374: Remove warnings from Koha/Booking.t > >t/db_dependent/Koha/Booking.t .. 1/2 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '7' for key 'PRIMARY' at /kohadevbox/koha/Koha/Object.pm line 174 >DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Data truncated for column 'status' at row 1 at /kohadevbox/koha/Koha/Object.pm line 174 >--- > t/db_dependent/Koha/Booking.t | 29 +++++++++++++++++++++++------ > 1 file changed, 23 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Koha/Booking.t b/t/db_dependent/Koha/Booking.t >index f1fba22d660..a63d37b120f 100755 >--- a/t/db_dependent/Koha/Booking.t >+++ b/t/db_dependent/Koha/Booking.t >@@ -20,7 +20,10 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 2; >+use Test::More tests => 3; >+use Test::NoWarnings; >+ >+use Test::Warn; > > use Test::Exception; > >@@ -369,7 +372,7 @@ subtest 'store() tests' => sub { > }; > > subtest 'confirmation notice trigger' => sub { >- plan tests => 2; >+ plan tests => 4; > > # FIXME: This is a bandaid solution to prevent test failures when running > # the Koha_Main_My8 job because notices are not added at upgrade time. >@@ -412,7 +415,16 @@ subtest 'store() tests' => sub { > )->count; > > # Reuse previous booking to produce a clash >- eval { $booking = Koha::Booking->new( $booking->unblessed )->store }; >+ warning_like( >+ sub { >+ throws_ok { >+ Koha::Booking->new( $booking->unblessed )->store >+ } >+ 'Koha::Exceptions::Object::DuplicateID', >+ 'Exception is thrown correctly'; >+ }, >+ qr{Duplicate entry '(.*?)' for key '(.*\.?)PRIMARY'} >+ ); > > my $post_notices_count = Koha::Notice::Messages->search( > { >@@ -612,12 +624,17 @@ subtest 'store() tests' => sub { > }; > > subtest 'status change exception' => sub { >- plan tests => 2; >+ plan tests => 3; > > $booking->discard_changes; > my $status = $booking->status; >- throws_ok { $booking->update( { status => 'blah' } ) } 'Koha::Exceptions::Object::BadValue', >- 'Throws exception when passed booking status would fail enum constraint'; >+ warning_like( >+ sub { >+ throws_ok { $booking->update( { status => 'blah' } ) } 'Koha::Exceptions::Object::BadValue', >+ 'Throws exception when passed booking status would fail enum constraint'; >+ }, >+ qr{Data truncated for column 'status'} >+ ); > > # Status unchanged > $booking->discard_changes; >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40374
:
184077
|
184243