Lines 27-33
use Koha::Hold;
Link Here
|
27 |
use t::lib::TestBuilder; |
27 |
use t::lib::TestBuilder; |
28 |
use t::lib::Mocks; |
28 |
use t::lib::Mocks; |
29 |
|
29 |
|
30 |
use Test::More tests => 14; |
30 |
use Test::More tests => 17; |
31 |
|
31 |
|
32 |
my $dbh = C4::Context->dbh; |
32 |
my $dbh = C4::Context->dbh; |
33 |
my $schema = Koha::Database->new()->schema(); |
33 |
my $schema = Koha::Database->new()->schema(); |
Lines 104-109
$builder->build(
Link Here
|
104 |
my $item = pop(@items); |
104 |
my $item = pop(@items); |
105 |
my $patron = pop(@patrons); |
105 |
my $patron = pop(@patrons); |
106 |
|
106 |
|
|
|
107 |
my $orig_due = C4::Circulation::CalcDateDue( |
108 |
DateTime->now(time_zone => C4::Context->tz()), |
109 |
$item->effective_itemtype, |
110 |
$patron->branchcode, |
111 |
$patron->unblessed |
112 |
); |
113 |
|
107 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHolds', 1 ); |
114 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHolds', 1 ); |
108 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsDuration', 1 ); |
115 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsDuration', 1 ); |
109 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsValue', 1 ); |
116 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsValue', 1 ); |
Lines 119-124
is( $data->{outstanding}, 6, "Should have 5 outstanding holds" );
Link Here
|
119 |
is( $data->{duration}, 1, "Should have duration of 1" ); |
126 |
is( $data->{duration}, 1, "Should have duration of 1" ); |
120 |
is( ref( $data->{due_date} ), 'DateTime', "due_date should be a DateTime object" ); |
127 |
is( ref( $data->{due_date} ), 'DateTime', "due_date should be a DateTime object" ); |
121 |
|
128 |
|
|
|
129 |
my $duedate = $data->{due_date}; |
130 |
is($duedate->hour, $orig_due->hour, 'New due hour is equal to original due hour.'); |
131 |
is($duedate->min, $orig_due->min, 'New due minute is equal to original due minute.'); |
132 |
is($duedate->sec, 0, 'New due date second is zero.'); |
133 |
|
122 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsControl', 'dynamic' ); |
134 |
t::lib::Mocks::mock_preference( 'decreaseLoanHighHoldsControl', 'dynamic' ); |
123 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
135 |
$data = C4::Circulation::checkHighHolds( $item_hr, $patron_hr ); |
124 |
is( $data->{exceeded}, 0, "Should not exceed threshold" ); |
136 |
is( $data->{exceeded}, 0, "Should not exceed threshold" ); |
125 |
- |
|
|