View | Details | Raw Unified | Return to bug 25951
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Holds.t (-2 / +13 lines)
Lines 35-41 $schema->storage->txn_begin; Link Here
35
my $builder = t::lib::TestBuilder->new;
35
my $builder = t::lib::TestBuilder->new;
36
36
37
subtest 'DB constraints' => sub {
37
subtest 'DB constraints' => sub {
38
    plan tests => 1;
38
    plan tests => 2;
39
39
40
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
40
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
41
    my $item = $builder->build_sample_item;
41
    my $item = $builder->build_sample_item;
Lines 55-61 subtest 'DB constraints' => sub { Link Here
55
        eval { $hold->priority(undef)->store }
55
        eval { $hold->priority(undef)->store }
56
    }
56
    }
57
    qr{.*DBD::mysql::st execute failed: Column 'priority' cannot be null.*},
57
    qr{.*DBD::mysql::st execute failed: Column 'priority' cannot be null.*},
58
      'DBD should have raised an error about priority that cannot be null';
58
        'DBD should have raised an error about priority that cannot be null';
59
60
    subtest 'Related objects' => sub {
61
        plan tests => 3;
62
        my $item = $hold->item;
63
        is(ref($item), 'Koha::Item', 'Returns a Koha::Item resultset' );
64
        my $patron = $hold->borrower;
65
        is(ref($patron), 'Koha::Patron', 'Returns a Koha::Patron resultset' );
66
        my $library = $hold->branch;
67
        is(ref($library), 'Koha::Library', 'Returns a Koha::Branch resultset' );
68
    };
69
59
};
70
};
60
71
61
subtest 'cancel' => sub {
72
subtest 'cancel' => sub {
(-)a/t/db_dependent/Koha/Item/RelatedObjects.t (-1 / +55 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2020 BULAC
4
#
5
# This file is part of Koha
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Test::More tests => 2;
23
24
use C4::Biblio;
25
use C4::Circulation;
26
27
use Koha::Items;
28
use Koha::Database;
29
use Koha::Old::Items;
30
31
use List::MoreUtils qw(all);
32
33
use t::lib::TestBuilder;
34
use t::lib::Mocks;
35
36
my $schema  = Koha::Database->new->schema;
37
my $builder = t::lib::TestBuilder->new;
38
39
40
$schema->storage->txn_begin;
41
my $library     = $builder->build( { source => 'Branch' } );
42
my  $nb_of_items = Koha::Items->search->count;
43
my $biblio      = $builder->build_sample_biblio();
44
my $new_item   = $builder->build_sample_item({
45
    biblionumber => $biblio->biblionumber,
46
    homebranch       => $library->{branchcode},
47
    holdingbranch    => $library->{branchcode},
48
                                               });
49
my $home_branch = $new_item->home_branch;
50
is(ref($home_branch), 'Koha::Library', 'Returns a Koha::Library resultset' );
51
my $holding_branch = $new_item->holding_branch;
52
is(ref($holding_branch), 'Koha::Library', 'Returns a Koha::Library resultset' );
53
$schema->storage->txn_rollback;
54
55

Return to bug 25951