use Modern::Perl;
-use Test::More tests => 48;
+use Test::More tests => 50;
use DateTime::Duration;
use t::lib::Mocks;
)->store->itemnumber;
t::lib::Mocks::mock_preference( 'UpdateNotForLoanStatusOnCheckin', q{} );
+t::lib::Mocks::mock_preference( 'CataloguingLog', 1 );
+my $log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
+
AddReturn( 'barcode_3', $branchcode_1 );
my $item = Koha::Items->find( $itemnumber );
ok( $item->notforloan eq 1, 'UpdateNotForLoanStatusOnCheckin does not modify value when not enabled' );
AddReturn( 'barcode_3', $branchcode_1 );
$item = Koha::Items->find( $itemnumber );
ok( $item->notforloan eq 9, q{UpdateNotForLoanStatusOnCheckin updates notforloan value from 1 to 9 with setting "1: 9"} );
+my $log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
+is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged");
AddReturn( 'barcode_3', $branchcode_1 );
$item = Koha::Items->find( $itemnumber );
ok( $item2->location eq 'FIC', 'UpdateItemLocationOnCheckin does not modify value when not enabled' );
t::lib::Mocks::mock_preference( 'UpdateItemLocationOnCheckin', 'FIC: GEN' );
+$log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
AddReturn( 'barcode_4', $branchcode_1 );
$item2 = Koha::Items->find( $itemnumber2 );
is( $item2->location, 'GEN', q{UpdateItemLocationOnCheckin updates location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
is( $item2->permanent_location, 'GEN', q{UpdateItemLocationOnCheckin updates permanent_location value from 'FIC' to 'GEN' with setting "FIC: GEN"} );
+$log_count_after = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
+is($log_count_before, $log_count_after, "Change from UpdateNotForLoanStatusOnCheckin is not logged");
AddReturn( 'barcode_4', $branchcode_1 );
$item2 = Koha::Items->find( $itemnumber2 );
ok( $item2->location eq 'GEN', q{UpdateItemLocationOnCheckin does not update location value from 'GEN' with setting "FIC: GEN"} );