Lines 33-38
use Koha::Item::Transfer::Limits;
Link Here
|
33 |
use Koha::Items; |
33 |
use Koha::Items; |
34 |
use Koha::Database; |
34 |
use Koha::Database; |
35 |
use Koha::DateUtils qw( dt_from_string ); |
35 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
36 |
use Koha::Statistics; |
36 |
|
37 |
|
37 |
use t::lib::TestBuilder; |
38 |
use t::lib::TestBuilder; |
38 |
use t::lib::Mocks; |
39 |
use t::lib::Mocks; |
Lines 68-74
my $retrieved_item_1 = Koha::Items->find( $new_item_1->itemnumber );
Link Here
|
68 |
is( $retrieved_item_1->barcode, $new_item_1->barcode, 'Find a item by id should return the correct item' ); |
69 |
is( $retrieved_item_1->barcode, $new_item_1->barcode, 'Find a item by id should return the correct item' ); |
69 |
|
70 |
|
70 |
subtest 'store' => sub { |
71 |
subtest 'store' => sub { |
71 |
plan tests => 7; |
72 |
plan tests => 8; |
72 |
|
73 |
|
73 |
my $biblio = $builder->build_sample_biblio; |
74 |
my $biblio = $builder->build_sample_biblio; |
74 |
my $today = dt_from_string->set( hour => 0, minute => 0, second => 0 ); |
75 |
my $today = dt_from_string->set( hour => 0, minute => 0, second => 0 ); |
Lines 1363-1368
subtest 'store' => sub {
Link Here
|
1363 |
"Item modification logged" |
1364 |
"Item modification logged" |
1364 |
); |
1365 |
); |
1365 |
}; |
1366 |
}; |
|
|
1367 |
|
1368 |
subtest 'itemlost / statistics' => sub { # TODO BZ 34308 (gt zero checks) |
1369 |
plan tests => 5; |
1370 |
|
1371 |
my $item = $builder->build_sample_item; |
1372 |
$item->itemlost(-1)->store; # weird value; >0 test not triggered ? |
1373 |
is( Koha::Statistics->search( { itemnumber => $item->id } )->count, 0, 'No statistics added' ); |
1374 |
$item->itemlost(1)->store; |
1375 |
is( Koha::Statistics->search( { itemnumber => $item->id } )->count, 1, 'statistics added' ); |
1376 |
$item->itemlost(2)->store; |
1377 |
is( Koha::Statistics->search( { itemnumber => $item->id } )->count, 1, 'No statistics added, already lost' ); |
1378 |
$item->itemlost(-1)->store; # weird value; <=0 test triggered ? |
1379 |
is( Koha::Statistics->search( { itemnumber => $item->id } )->count, 2, 'statistics added' ); |
1380 |
$item->itemlost(-2)->store; # weird value, but no status change |
1381 |
is( Koha::Statistics->search( { itemnumber => $item->id } )->count, 2, 'No statistics added, already *found*' ); |
1382 |
}; |
1366 |
}; |
1383 |
}; |
1367 |
|
1384 |
|
1368 |
subtest 'get_transfer' => sub { |
1385 |
subtest 'get_transfer' => sub { |
1369 |
- |
|
|