Lines 19-27
use Modern::Perl;
Link Here
|
19 |
use Data::Dumper; |
19 |
use Data::Dumper; |
20 |
|
20 |
|
21 |
use MARC::Record; |
21 |
use MARC::Record; |
22 |
use C4::Items qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen ); |
22 |
use C4::Items qw( ModItemTransfer SearchItems AddItemFromMarc ModItemFromMarc get_hostitemnumbers_of Item2Marc ModDateLastSeen CartToShelf ); |
23 |
use C4::Biblio qw( GetMarcFromKohaField AddBiblio ); |
23 |
use C4::Biblio qw( GetMarcFromKohaField AddBiblio ); |
24 |
use C4::Circulation qw( AddIssue ); |
24 |
use C4::Circulation qw( AddIssue ); |
|
|
25 |
use Koha::BackgroundJobs; |
25 |
use Koha::Items; |
26 |
use Koha::Items; |
26 |
use Koha::Database; |
27 |
use Koha::Database; |
27 |
use Koha::DateUtils qw( dt_from_string ); |
28 |
use Koha::DateUtils qw( dt_from_string ); |
Lines 34-40
use Koha::AuthorisedValues;
Link Here
|
34 |
use t::lib::Mocks; |
35 |
use t::lib::Mocks; |
35 |
use t::lib::TestBuilder; |
36 |
use t::lib::TestBuilder; |
36 |
|
37 |
|
37 |
use Test::More tests => 12; |
38 |
use Test::More tests => 13; |
38 |
|
39 |
|
39 |
use Test::Warn; |
40 |
use Test::Warn; |
40 |
|
41 |
|
Lines 972-974
subtest 'ModDateLastSeen' => sub {
Link Here
|
972 |
is( $item->itemlost, 0, "Item no longer lost when no parameter is passed"); |
973 |
is( $item->itemlost, 0, "Item no longer lost when no parameter is passed"); |
973 |
is( $logs_after, $logs_before + 1, "ModDateLastSeen logs if item was lost and now found"); |
974 |
is( $logs_after, $logs_before + 1, "ModDateLastSeen logs if item was lost and now found"); |
974 |
}; |
975 |
}; |
975 |
- |
976 |
|
|
|
977 |
subtest 'CartToShelf test' => sub { |
978 |
plan tests => 2; |
979 |
|
980 |
$schema->storage->txn_begin; |
981 |
my $dbh = C4::Context->dbh; |
982 |
my $builder = t::lib::TestBuilder->new; |
983 |
|
984 |
my $item = $builder->build_sample_item(); |
985 |
|
986 |
$item->permanent_location('BANANA')->location('CART')->store(); |
987 |
|
988 |
CartToShelf( $item->id ); |
989 |
|
990 |
$item->discard_changes; |
991 |
|
992 |
is( $item->location, 'BANANA', 'Item is correctly returned to permanent location'); |
993 |
|
994 |
|
995 |
my $mock_RTHQ = Test::MockModule->new("Koha::BackgroundJob::BatchUpdateBiblioHoldsQueue"); |
996 |
$mock_RTHQ->mock( enqueue => sub { warn "RTHQ" } ); |
997 |
t::lib::Mocks::mock_preference('RealTimeHoldsQueue', '1'); |
998 |
|
999 |
$item->location('CART')->store({ skip_holds_queue => 1 }); |
1000 |
warnings_are{ |
1001 |
CartToShelf( $item->id ); |
1002 |
} [], 'No RTHQ update triggered by CartToShelf'; |
1003 |
|
1004 |
$schema->storage->txn_rollback; |
1005 |
|
1006 |
}; |
1007 |
|