|
Lines 31-37
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 31 |
|
31 |
|
| 32 |
subtest "store() tests" => sub { |
32 |
subtest "store() tests" => sub { |
| 33 |
|
33 |
|
| 34 |
plan tests => 13; |
34 |
plan tests => 11; |
| 35 |
|
35 |
|
| 36 |
$schema->storage->txn_begin; |
36 |
$schema->storage->txn_begin; |
| 37 |
|
37 |
|
|
Lines 109-139
subtest "store() tests" => sub {
Link Here
|
| 109 |
is( ref($claim), 'Koha::Checkouts::ReturnClaim', 'Object type is correct' ); |
109 |
is( ref($claim), 'Koha::Checkouts::ReturnClaim', 'Object type is correct' ); |
| 110 |
is( Koha::Checkouts::ReturnClaims->search( { issue_id => $checkout->id } )->count, 1, 'Claim stored on the DB'); |
110 |
is( Koha::Checkouts::ReturnClaims->search( { issue_id => $checkout->id } )->count, 1, 'Claim stored on the DB'); |
| 111 |
|
111 |
|
| 112 |
{ # hide useless warnings |
|
|
| 113 |
local *STDERR; |
| 114 |
open STDERR, '>', '/dev/null'; |
| 115 |
throws_ok { |
| 116 |
Koha::Checkouts::ReturnClaim->new( |
| 117 |
{ |
| 118 |
issue_id => $checkout->id, |
| 119 |
itemnumber => $checkout->itemnumber, |
| 120 |
borrowernumber => $checkout->borrowernumber, |
| 121 |
notes => 'Some notes', |
| 122 |
created_by => $librarian->borrowernumber |
| 123 |
} |
| 124 |
)->store; |
| 125 |
} |
| 126 |
'Koha::Exceptions::Object::DuplicateID', |
| 127 |
'An exception is thrown on duplicate issue_id'; |
| 128 |
close STDERR; |
| 129 |
|
| 130 |
like( |
| 131 |
$@->duplicate_id, |
| 132 |
qr/(return_claims\.)?issue_id/, |
| 133 |
'Exception field is correct' |
| 134 |
); |
| 135 |
} |
| 136 |
|
| 137 |
{ # hide useless warnings |
112 |
{ # hide useless warnings |
| 138 |
local *STDERR; |
113 |
local *STDERR; |
| 139 |
open STDERR, '>', '/dev/null'; |
114 |
open STDERR, '>', '/dev/null'; |
| 140 |
- |
|
|