Lines 28-34
use Koha::Item;
Link Here
|
28 |
use Koha::DateUtils; |
28 |
use Koha::DateUtils; |
29 |
use t::lib::TestBuilder; |
29 |
use t::lib::TestBuilder; |
30 |
|
30 |
|
31 |
use Test::More tests => 33; |
31 |
use Test::More tests => 29; |
32 |
use Test::Warn; |
32 |
use Test::Warn; |
33 |
|
33 |
|
34 |
use_ok('Koha::Hold'); |
34 |
use_ok('Koha::Hold'); |
Lines 98-126
my $hold_borrower = $hold->borrower();
Link Here
|
98 |
ok( $hold_borrower, 'Got hold borrower' ); |
98 |
ok( $hold_borrower, 'Got hold borrower' ); |
99 |
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' ); |
99 |
is( $hold_borrower->borrowernumber(), $borrower->{borrowernumber}, 'Hold borrower matches correct borrower' ); |
100 |
|
100 |
|
101 |
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '' ); |
|
|
102 |
$dt = $hold->waiting_expires_on(); |
103 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set" ); |
104 |
|
105 |
is( $hold->is_waiting, 1, 'The hold is waiting' ); |
101 |
is( $hold->is_waiting, 1, 'The hold is waiting' ); |
106 |
is( $hold->is_found, 1, 'The hold is found'); |
102 |
is( $hold->is_found, 1, 'The hold is found'); |
107 |
ok( !$hold->is_in_transit, 'The hold is not in transit' ); |
103 |
ok( !$hold->is_in_transit, 'The hold is not in transit' ); |
108 |
|
104 |
|
109 |
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' ); |
105 |
t::lib::Mocks::mock_preference( 'ReservesMaxPickUpDelay', '5' ); |
110 |
$dt = $hold->waiting_expires_on(); |
|
|
111 |
is( $dt->ymd, "2000-01-06", |
112 |
"Koha::Hold->waiting_expires_on returns DateTime of waitingdate + ReservesMaxPickUpDelay if set" ); |
113 |
|
114 |
$hold->found('T'); |
106 |
$hold->found('T'); |
115 |
$dt = $hold->waiting_expires_on(); |
|
|
116 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to 'T' )" ); |
117 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' ); |
107 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' ); |
118 |
is( $hold->is_found, 1, 'The hold is found'); |
108 |
is( $hold->is_found, 1, 'The hold is found'); |
119 |
is( $hold->is_in_transit, 1, 'The hold is in transit' ); |
109 |
is( $hold->is_in_transit, 1, 'The hold is in transit' ); |
120 |
|
110 |
|
121 |
$hold->found(q{}); |
111 |
$hold->found(q{}); |
122 |
$dt = $hold->waiting_expires_on(); |
|
|
123 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to empty string )" ); |
124 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' ); |
112 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' ); |
125 |
is( $hold->is_found, 0, 'The hold is not found' ); |
113 |
is( $hold->is_found, 0, 'The hold is not found' ); |
126 |
ok( !$hold->is_in_transit, 'The hold is not in transit' ); |
114 |
ok( !$hold->is_in_transit, 'The hold is not in transit' ); |
127 |
- |
|
|