Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 6; |
22 |
use Test::More tests => 7; |
23 |
|
23 |
|
24 |
use Test::Exception; |
24 |
use Test::Exception; |
25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
Lines 36-41
use Koha::Old::Holds;
Link Here
|
36 |
my $schema = Koha::Database->new->schema; |
36 |
my $schema = Koha::Database->new->schema; |
37 |
my $builder = t::lib::TestBuilder->new; |
37 |
my $builder = t::lib::TestBuilder->new; |
38 |
|
38 |
|
|
|
39 |
subtest 'store() tests' => sub { |
40 |
plan tests => 2; |
41 |
|
42 |
$schema->storage->txn_begin; |
43 |
|
44 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
45 |
my $item = $builder->build_sample_item; |
46 |
throws_ok { |
47 |
Koha::Hold->new( |
48 |
{ |
49 |
borrowernumber => $patron->borrowernumber, |
50 |
biblionumber => $item->biblionumber, |
51 |
priority => 1, |
52 |
itemnumber => $item->itemnumber, |
53 |
} |
54 |
)->store |
55 |
} |
56 |
'Koha::Exceptions::Hold::MissingPickupLocation', |
57 |
'Exception thrown because branchcode was not passed'; |
58 |
|
59 |
my $hold = $builder->build_object( { class => 'Koha::Holds' } ); |
60 |
throws_ok { |
61 |
$hold->branchcode(undef)->store; |
62 |
} |
63 |
'Koha::Exceptions::Hold::MissingPickupLocation', |
64 |
'Exception thrown if one tries to set branchcode to null'; |
65 |
|
66 |
$schema->storage->txn_rollback; |
67 |
}; |
68 |
|
39 |
subtest 'fill() tests' => sub { |
69 |
subtest 'fill() tests' => sub { |
40 |
|
70 |
|
41 |
plan tests => 13; |
71 |
plan tests => 13; |
42 |
- |
|
|