Lines 2985-2991
subtest 'AddReturn should clear items.onloan for unissued items' => sub {
Link Here
|
2985 |
|
2985 |
|
2986 |
subtest 'AddRenewal and AddIssuingCharge tests' => sub { |
2986 |
subtest 'AddRenewal and AddIssuingCharge tests' => sub { |
2987 |
|
2987 |
|
2988 |
plan tests => 10; |
2988 |
plan tests => 11; |
2989 |
|
2989 |
|
2990 |
|
2990 |
|
2991 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
2991 |
t::lib::Mocks::mock_preference('item-level_itypes', 1); |
Lines 3062-3072
subtest 'AddRenewal and AddIssuingCharge tests' => sub {
Link Here
|
3062 |
is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' ); |
3062 |
is( $line->description, '', 'AddRenewal does not set a hardcoded description for the accountline' ); |
3063 |
|
3063 |
|
3064 |
t::lib::Mocks::mock_preference( 'RenewalLog', 1 ); |
3064 |
t::lib::Mocks::mock_preference( 'RenewalLog', 1 ); |
|
|
3065 |
|
3066 |
$context = Test::MockModule->new('C4::Context'); |
3067 |
$context->mock( userenv => { branch => undef, interface => 'CRON'} ); #Test statistical logging of renewal via cron (atuo_renew) |
3068 |
|
3065 |
$date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); |
3069 |
$date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } ); |
3066 |
$old_log_size = Koha::ActionLogs->count( \%params_renewal ); |
3070 |
$old_log_size = Koha::ActionLogs->count( \%params_renewal ); |
|
|
3071 |
my $sth = $dbh->prepare("SELECT COUNT(*) FROM statistics WHERE itemnumber = ? AND branch = ?"); |
3072 |
$sth->execute($item->id, $library->id); |
3073 |
my ($old_stats_size) = $sth->fetchrow_array; |
3067 |
AddRenewal( $patron->id, $item->id, $library->id ); |
3074 |
AddRenewal( $patron->id, $item->id, $library->id ); |
3068 |
$new_log_size = Koha::ActionLogs->count( \%params_renewal ); |
3075 |
$new_log_size = Koha::ActionLogs->count( \%params_renewal ); |
|
|
3076 |
$sth->execute($item->id, $library->id); |
3077 |
my ($new_stats_size) = $sth->fetchrow_array; |
3069 |
is( $new_log_size, $old_log_size + 1, 'renew log successfully added' ); |
3078 |
is( $new_log_size, $old_log_size + 1, 'renew log successfully added' ); |
|
|
3079 |
is( $new_stats_size, $old_stats_size + 1, 'renew statistic successfully added with passed branch' ); |
3070 |
|
3080 |
|
3071 |
}; |
3081 |
}; |
3072 |
|
3082 |
|
3073 |
- |
|
|