Lines 30-36
my $builder = t::lib::TestBuilder->new;
Link Here
|
30 |
|
30 |
|
31 |
subtest "store() tests" => sub { |
31 |
subtest "store() tests" => sub { |
32 |
|
32 |
|
33 |
plan tests => 6; |
33 |
plan tests => 8; |
34 |
|
34 |
|
35 |
$schema->storage->txn_begin; |
35 |
$schema->storage->txn_begin; |
36 |
|
36 |
|
Lines 82-88
subtest "store() tests" => sub {
Link Here
|
82 |
throws_ok { |
82 |
throws_ok { |
83 |
Koha::Checkouts::ReturnClaim->new( |
83 |
Koha::Checkouts::ReturnClaim->new( |
84 |
{ |
84 |
{ |
85 |
issue_id => $checkout->id + 1000, |
85 |
issue_id => $checkout->id, |
86 |
itemnumber => $checkout->itemnumber, |
86 |
itemnumber => $checkout->itemnumber, |
87 |
borrowernumber => $checkout->borrowernumber, |
87 |
borrowernumber => $checkout->borrowernumber, |
88 |
notes => 'Some notes', |
88 |
notes => 'Some notes', |
Lines 90-105
subtest "store() tests" => sub {
Link Here
|
90 |
} |
90 |
} |
91 |
)->store; |
91 |
)->store; |
92 |
} |
92 |
} |
93 |
'Koha::Exceptions::Object::FKConstraint', |
93 |
'Koha::Exceptions::Object::DuplicateID', |
94 |
'An exception is thrown on invalid issue_id'; |
94 |
'An exception is thrown on duplicate issue_id'; |
95 |
close STDERR; |
95 |
close STDERR; |
96 |
|
96 |
|
97 |
is( |
97 |
is( |
98 |
$@->broken_fk, |
98 |
$@->duplicate_id, |
99 |
'issue_id', |
99 |
'issue_id', |
100 |
'Exception field is correct' |
100 |
'Exception field is correct' |
101 |
); |
101 |
); |
102 |
} |
102 |
} |
103 |
|
103 |
|
|
|
104 |
{ # hide useless warnings |
105 |
local *STDERR; |
106 |
open STDERR, '>', '/dev/null'; |
107 |
|
108 |
my $another_checkout = $builder->build_object({ class => 'Koha::Checkouts' }); |
109 |
my $checkout_id = $another_checkout->id; |
110 |
$another_checkout->delete; |
111 |
|
112 |
my $THE_claim; |
113 |
|
114 |
throws_ok { |
115 |
$THE_claim = Koha::Checkouts::ReturnClaim->new( |
116 |
{ |
117 |
issue_id => $checkout_id, |
118 |
itemnumber => $checkout->itemnumber, |
119 |
borrowernumber => $checkout->borrowernumber, |
120 |
notes => 'Some notes', |
121 |
created_by => $librarian->borrowernumber |
122 |
} |
123 |
)->store; |
124 |
} |
125 |
'Koha::Exceptions::Object::FKConstraint', |
126 |
'An exception is thrown on invalid issue_id'; |
127 |
close STDERR; |
128 |
|
129 |
is( $@->broken_fk, 'issue_id', 'Exception field is correct' ); |
130 |
} |
131 |
|
104 |
$schema->storage->txn_rollback; |
132 |
$schema->storage->txn_rollback; |
105 |
}; |
133 |
}; |
106 |
- |
|
|