|
Lines 20-26
use Modern::Perl;
Link Here
|
| 20 |
use C4::Context; |
20 |
use C4::Context; |
| 21 |
use Koha::Database; |
21 |
use Koha::Database; |
| 22 |
|
22 |
|
| 23 |
use Test::More tests => 5; |
23 |
use Test::More tests => 8; |
| 24 |
|
24 |
|
| 25 |
use_ok('Koha::Hold'); |
25 |
use_ok('Koha::Hold'); |
| 26 |
|
26 |
|
|
Lines 36-41
C4::Context->set_preference( 'ReservesMaxPickUpDelay', '' );
Link Here
|
| 36 |
my $dt = $hold->waiting_expires_on(); |
36 |
my $dt = $hold->waiting_expires_on(); |
| 37 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set"); |
37 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set"); |
| 38 |
|
38 |
|
|
|
39 |
is( $hold->is_waiting, 1, 'The hold is waiting' ); |
| 40 |
|
| 39 |
C4::Context->set_preference( 'ReservesMaxPickUpDelay', '5' ); |
41 |
C4::Context->set_preference( 'ReservesMaxPickUpDelay', '5' ); |
| 40 |
$dt = $hold->waiting_expires_on(); |
42 |
$dt = $hold->waiting_expires_on(); |
| 41 |
is( $dt->ymd, "2000-01-06", "Koha::Hold->waiting_expires_on returns DateTime of waitingdate + ReservesMaxPickUpDelay if set"); |
43 |
is( $dt->ymd, "2000-01-06", "Koha::Hold->waiting_expires_on returns DateTime of waitingdate + ReservesMaxPickUpDelay if set"); |
|
Lines 43-52
is( $dt->ymd, "2000-01-06", "Koha::Hold->waiting_expires_on returns DateTime of
Link Here
|
| 43 |
$hold->found('T'); |
45 |
$hold->found('T'); |
| 44 |
$dt = $hold->waiting_expires_on(); |
46 |
$dt = $hold->waiting_expires_on(); |
| 45 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to 'T' )"); |
47 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to 'T' )"); |
|
|
48 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (T)' ); |
| 46 |
|
49 |
|
| 47 |
$hold->found(q{}); |
50 |
$hold->found(q{}); |
| 48 |
$dt = $hold->waiting_expires_on(); |
51 |
$dt = $hold->waiting_expires_on(); |
| 49 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to empty string )"); |
52 |
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if found is not 'W' ( Set to empty string )"); |
|
|
53 |
isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' ); |
| 50 |
|
54 |
|
| 51 |
$schema->storage->txn_rollback(); |
55 |
$schema->storage->txn_rollback(); |
| 52 |
|
56 |
|
| 53 |
- |
|
|