Lines 20-29
Link Here
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Koha::Database; |
22 |
use Koha::Database; |
|
|
23 |
use Koha::DateUtils; |
23 |
|
24 |
|
24 |
use t::lib::TestBuilder; |
25 |
use t::lib::TestBuilder; |
25 |
|
26 |
|
26 |
use Test::More tests => 3; |
27 |
use Test::More tests => 4; |
27 |
use Test::Exception; |
28 |
use Test::Exception; |
28 |
|
29 |
|
29 |
my $schema = Koha::Database->new->schema; |
30 |
my $schema = Koha::Database->new->schema; |
Lines 167-171
subtest 'receipt tests' => sub {
Link Here
|
167 |
# Last seen |
168 |
# Last seen |
168 |
ok( $item->datelastseen, 'Receipt set item datelastseen date' ); |
169 |
ok( $item->datelastseen, 'Receipt set item datelastseen date' ); |
169 |
|
170 |
|
|
|
171 |
$schema->storage->txn_rollback; |
172 |
}; |
173 |
|
174 |
subtest 'in_transit tests' => sub { |
175 |
|
176 |
plan tests => 3; |
177 |
|
178 |
$schema->storage->txn_begin; |
179 |
|
180 |
my $library_from = $builder->build_object( { class => 'Koha::Libraries' } ); |
181 |
my $library_to = $builder->build_object( { class => 'Koha::Libraries' } ); |
182 |
my $item = $builder->build_sample_item( |
183 |
{ |
184 |
homebranch => $library_to->branchcode, |
185 |
holdingbranch => $library_from->branchcode, |
186 |
} |
187 |
); |
188 |
|
189 |
my $transfer = Koha::Item::Transfer->new( |
190 |
{ |
191 |
itemnumber => $item->itemnumber, |
192 |
frombranch => $library_from->branchcode, |
193 |
tobranch => $library_to->branchcode, |
194 |
daterequested => dt_from_string, |
195 |
} |
196 |
)->store; |
197 |
|
198 |
ok( !$transfer->in_transit, 'in_transit returns false when only daterequested is defined' ); |
199 |
|
200 |
$transfer->datesent(dt_from_string)->store; |
201 |
ok( $transfer->in_transit, 'in_transit returns true when datesent is defined'); |
202 |
|
203 |
$transfer->datearrived(dt_from_string)->store; |
204 |
ok( !$transfer->in_transit, 'in_transit returns false when datearrived is defined'); |
205 |
|
206 |
|
170 |
$schema->storage->txn_rollback; |
207 |
$schema->storage->txn_rollback; |
171 |
}; |
208 |
}; |
172 |
- |
|
|