|
Lines 2-8
Link Here
|
| 2 |
|
2 |
|
| 3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
| 4 |
|
4 |
|
| 5 |
use Test::More tests => 6; |
5 |
use Test::More tests => 7; |
| 6 |
use Test::MockModule; |
6 |
use Test::MockModule; |
| 7 |
use DBI; |
7 |
use DBI; |
| 8 |
use DateTime; |
8 |
use DateTime; |
|
Lines 36-41
Koha::Database->schema->resultset('Issuingrule')->create({
Link Here
|
| 36 |
t::lib::Mocks::mock_preference('ReturnBeforeExpiry', 1); |
36 |
t::lib::Mocks::mock_preference('ReturnBeforeExpiry', 1); |
| 37 |
t::lib::Mocks::mock_preference('useDaysMode', 'Days'); |
37 |
t::lib::Mocks::mock_preference('useDaysMode', 'Days'); |
| 38 |
|
38 |
|
|
|
39 |
my $cache = Koha::Caches->get_instance(); |
| 40 |
$cache->clear_from_cache('single_holidays'); |
| 41 |
|
| 39 |
my $dateexpiry = '2013-01-01'; |
42 |
my $dateexpiry = '2013-01-01'; |
| 40 |
|
43 |
|
| 41 |
my $borrower = {categorycode => 'B', dateexpiry => $dateexpiry}; |
44 |
my $borrower = {categorycode => 'B', dateexpiry => $dateexpiry}; |
|
Lines 66-71
$calendar->insert_single_holiday(
Link Here
|
| 66 |
); |
69 |
); |
| 67 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower ); |
70 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower ); |
| 68 |
is($date, '2012-12-31T23:59:00', 'date expiry should be 2013-01-01 -1 day'); |
71 |
is($date, '2012-12-31T23:59:00', 'date expiry should be 2013-01-01 -1 day'); |
|
|
72 |
$calendar->insert_single_holiday( |
| 73 |
day => 31, |
| 74 |
month => 12, |
| 75 |
year => 2012, |
| 76 |
title =>'holidayTest', |
| 77 |
description => 'holidayDesc' |
| 78 |
); |
| 79 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower ); |
| 80 |
is($date, '2012-12-30T23:59:00', 'date expiry should be 2013-01-01 -2 day'); |
| 69 |
|
81 |
|
| 70 |
|
82 |
|
| 71 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); |
83 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); |
|
Lines 83-86
is($date, '2013-02-' . (9 + $issuelength) . 'T23:59:00', "date expiry ( 9 + $iss
Link Here
|
| 83 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); |
95 |
$date = C4::Circulation::CalcDateDue( $start_date, $itemtype, $branchcode, $borrower, 1 ); |
| 84 |
is($date, '2013-02-' . (9 + $renewalperiod) . 'T23:59:00', "date expiry ( 9 + $renewalperiod )"); |
96 |
is($date, '2013-02-' . (9 + $renewalperiod) . 'T23:59:00', "date expiry ( 9 + $renewalperiod )"); |
| 85 |
|
97 |
|
|
|
98 |
$cache->clear_from_cache('single_holidays'); |
| 86 |
$schema->storage->txn_rollback; |
99 |
$schema->storage->txn_rollback; |
| 87 |
- |
|
|