|
Lines 20-26
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use utf8; |
21 |
use utf8; |
| 22 |
|
22 |
|
| 23 |
use Test::More tests => 2; |
23 |
use Test::More tests => 3; |
|
|
24 |
use Test::NoWarnings; |
| 25 |
|
| 26 |
use Test::Warn; |
| 24 |
|
27 |
|
| 25 |
use Test::Exception; |
28 |
use Test::Exception; |
| 26 |
|
29 |
|
|
Lines 369-375
subtest 'store() tests' => sub {
Link Here
|
| 369 |
}; |
372 |
}; |
| 370 |
|
373 |
|
| 371 |
subtest 'confirmation notice trigger' => sub { |
374 |
subtest 'confirmation notice trigger' => sub { |
| 372 |
plan tests => 2; |
375 |
plan tests => 4; |
| 373 |
|
376 |
|
| 374 |
# FIXME: This is a bandaid solution to prevent test failures when running |
377 |
# FIXME: This is a bandaid solution to prevent test failures when running |
| 375 |
# the Koha_Main_My8 job because notices are not added at upgrade time. |
378 |
# the Koha_Main_My8 job because notices are not added at upgrade time. |
|
Lines 412-418
subtest 'store() tests' => sub {
Link Here
|
| 412 |
)->count; |
415 |
)->count; |
| 413 |
|
416 |
|
| 414 |
# Reuse previous booking to produce a clash |
417 |
# Reuse previous booking to produce a clash |
| 415 |
eval { $booking = Koha::Booking->new( $booking->unblessed )->store }; |
418 |
warning_like( |
|
|
419 |
sub { |
| 420 |
throws_ok { |
| 421 |
Koha::Booking->new( $booking->unblessed )->store |
| 422 |
} |
| 423 |
'Koha::Exceptions::Object::DuplicateID', |
| 424 |
'Exception is thrown correctly'; |
| 425 |
}, |
| 426 |
qr{Duplicate entry '(.*?)' for key '(.*\.?)PRIMARY'} |
| 427 |
); |
| 416 |
|
428 |
|
| 417 |
my $post_notices_count = Koha::Notice::Messages->search( |
429 |
my $post_notices_count = Koha::Notice::Messages->search( |
| 418 |
{ |
430 |
{ |
|
Lines 612-623
subtest 'store() tests' => sub {
Link Here
|
| 612 |
}; |
624 |
}; |
| 613 |
|
625 |
|
| 614 |
subtest 'status change exception' => sub { |
626 |
subtest 'status change exception' => sub { |
| 615 |
plan tests => 2; |
627 |
plan tests => 3; |
| 616 |
|
628 |
|
| 617 |
$booking->discard_changes; |
629 |
$booking->discard_changes; |
| 618 |
my $status = $booking->status; |
630 |
my $status = $booking->status; |
| 619 |
throws_ok { $booking->update( { status => 'blah' } ) } 'Koha::Exceptions::Object::BadValue', |
631 |
warning_like( |
| 620 |
'Throws exception when passed booking status would fail enum constraint'; |
632 |
sub { |
|
|
633 |
throws_ok { $booking->update( { status => 'blah' } ) } 'Koha::Exceptions::Object::BadValue', |
| 634 |
'Throws exception when passed booking status would fail enum constraint'; |
| 635 |
}, |
| 636 |
qr{Data truncated for column 'status'} |
| 637 |
); |
| 621 |
|
638 |
|
| 622 |
# Status unchanged |
639 |
# Status unchanged |
| 623 |
$booking->discard_changes; |
640 |
$booking->discard_changes; |
| 624 |
- |
|
|