View | Details | Raw Unified | Return to bug 14310
Collapse All | Expand All

(-)a/t/db_dependent/Hold.t (-6 / +22 lines)
Lines 23-30 use Koha::Database; Link Here
23
use Koha::Borrowers;
23
use Koha::Borrowers;
24
use Koha::Branches;
24
use Koha::Branches;
25
use Koha::Item;
25
use Koha::Item;
26
use Koha::DateUtils;
26
27
27
use Test::More tests => 23;
28
use Test::More tests => 31;
28
29
29
use_ok('Koha::Hold');
30
use_ok('Koha::Hold');
30
31
Lines 57-72 $item->store(); Link Here
57
58
58
my $hold = Koha::Hold->new(
59
my $hold = Koha::Hold->new(
59
    {
60
    {
60
        biblionumber     => $biblionumber,
61
        biblionumber   => $biblionumber,
61
        itemnumber => $item->id(),
62
        itemnumber     => $item->id(),
62
        found          => 'W',
63
        waitingdate    => '2000-01-01',
63
        waitingdate    => '2000-01-01',
64
        borrowernumber => $borrower->borrowernumber(),
64
        borrowernumber => $borrower->borrowernumber(),
65
        branchcode     => $branches[1]->branchcode(),
65
        branchcode     => $branches[1]->branchcode(),
66
        suspend        => 0,
66
    }
67
    }
67
);
68
);
68
$hold->store();
69
$hold->store();
69
70
71
is( $hold->suspend, 0, "Hold is not suspended" );
72
$hold->suspend_hold();
73
is( $hold->suspend, 1, "Hold is suspended" );
74
$hold->resume();
75
is( $hold->suspend, 0, "Hold is not suspended" );
76
my $dt = dt_from_string();
77
$hold->suspend_hold( $dt );
78
is( $hold->suspend, 1, "Hold is suspended" );
79
is( $hold->suspend_until, "$dt", "Hold is suspended with a date" );
80
$hold->resume();
81
is( $hold->suspend, 0, "Hold is not suspended" );
82
is( $hold->suspend_until, undef, "Hold no longer has suspend_until date" );
83
$hold->found('W');
84
$hold->suspend_hold();
85
is( $hold->suspend, 0, "Waiting hold cannot be suspended" );
86
70
$item = $hold->item();
87
$item = $hold->item();
71
88
72
my $hold_borrower = $hold->borrower();
89
my $hold_borrower = $hold->borrower();
Lines 74-80 ok( $hold_borrower, 'Got hold borrower' ); Link Here
74
is( $hold_borrower->borrowernumber(), $borrower->borrowernumber(), 'Hold borrower matches correct borrower' );
91
is( $hold_borrower->borrowernumber(), $borrower->borrowernumber(), 'Hold borrower matches correct borrower' );
75
92
76
C4::Context->set_preference( 'ReservesMaxPickUpDelay', '' );
93
C4::Context->set_preference( 'ReservesMaxPickUpDelay', '' );
77
my $dt = $hold->waiting_expires_on();
94
$dt = $hold->waiting_expires_on();
78
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set" );
95
is( $dt, undef, "Koha::Hold->waiting_expires_on returns undef if ReservesMaxPickUpDelay is not set" );
79
96
80
is( $hold->is_waiting, 1, 'The hold is waiting' );
97
is( $hold->is_waiting, 1, 'The hold is waiting' );
81
- 

Return to bug 14310