Bug 24722: Add test
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
5037d7f355
commit
08576a23cc
1 changed files with 26 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# Copyright 2017 Koha Development team
|
||||
# Copyright 2020 Koha Development team
|
||||
#
|
||||
# This file is part of Koha
|
||||
#
|
||||
|
@ -19,7 +19,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 1;
|
||||
use Test::More tests => 2;
|
||||
use Test::Warn;
|
||||
|
||||
use C4::Reserves;
|
||||
|
@ -34,6 +34,30 @@ $schema->storage->txn_begin;
|
|||
|
||||
my $builder = t::lib::TestBuilder->new;
|
||||
|
||||
subtest 'DB constraints' => sub {
|
||||
plan tests => 1;
|
||||
|
||||
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
|
||||
my $item = $builder->build_sample_item;
|
||||
my $hold_info = {
|
||||
branchcode => $patron->branchcode,
|
||||
borrowernumber => $patron->borrowernumber,
|
||||
biblionumber => $item->biblionumber,
|
||||
priority => 1,
|
||||
title => "title for fee",
|
||||
itemnumber => $item->itemnumber,
|
||||
};
|
||||
|
||||
my $reserve_id = C4::Reserves::AddReserve($hold_info);
|
||||
my $hold = Koha::Holds->find( $reserve_id );
|
||||
|
||||
warning_like {
|
||||
eval { $hold->priority(undef)->store }
|
||||
}
|
||||
qr{.*DBD::mysql::st execute failed: Column 'priority' cannot be null.*},
|
||||
'DBD should have raised an error about priority that cannot be null';
|
||||
};
|
||||
|
||||
subtest 'cancel' => sub {
|
||||
plan tests => 12;
|
||||
my $biblioitem = $builder->build_object( { class => 'Koha::Biblioitems' } );
|
||||
|
|
Loading…
Reference in a new issue