Lines 56-62
my $policy = Koha::CurbsidePickupPolicy->new(
Link Here
|
56 |
branchcode => $library->branchcode, |
56 |
branchcode => $library->branchcode, |
57 |
enabled => 1, |
57 |
enabled => 1, |
58 |
enable_waiting_holds_only => 0, |
58 |
enable_waiting_holds_only => 0, |
59 |
pickup_interval => 30, |
59 |
pickup_interval => 15, |
60 |
patrons_per_interval => 2, |
60 |
patrons_per_interval => 2, |
61 |
patron_scheduled_pickup => 1 |
61 |
patron_scheduled_pickup => 1 |
62 |
} |
62 |
} |
Lines 73-84
my $policy_disabled = Koha::CurbsidePickupPolicy->new(
Link Here
|
73 |
)->store; |
73 |
)->store; |
74 |
|
74 |
|
75 |
# Open Mondays from 12 to 18 |
75 |
# Open Mondays from 12 to 18 |
76 |
$policy->add_opening_slot('1-12:00-18:00'); |
76 |
$policy->add_opening_slot('1-12:00-18:45'); |
77 |
|
77 |
|
78 |
my $today = dt_from_string; |
78 |
my $today = dt_from_string; |
79 |
|
79 |
|
80 |
subtest 'Create a pickup' => sub { |
80 |
subtest 'Create a pickup' => sub { |
81 |
plan tests => 9; |
81 |
plan tests => 10; |
82 |
|
82 |
|
83 |
# Day and datetime are ok |
83 |
# Day and datetime are ok |
84 |
my $next_monday = |
84 |
my $next_monday = |
Lines 99-105
subtest 'Create a pickup' => sub {
Link Here
|
99 |
'Koha::Exceptions::CurbsidePickup::NotEnabled', |
99 |
'Koha::Exceptions::CurbsidePickup::NotEnabled', |
100 |
'Cannot create pickup if the policy does not allow it'; |
100 |
'Cannot create pickup if the policy does not allow it'; |
101 |
|
101 |
|
102 |
$policy->enable_waiting_holds_only(1)->store; |
102 |
$policy->enabled(1)->store; |
|
|
103 |
|
104 |
$policy->enable_waiting_holds_only(1)->store; |
103 |
throws_ok { |
105 |
throws_ok { |
104 |
Koha::CurbsidePickup->new($params)->store; |
106 |
Koha::CurbsidePickup->new($params)->store; |
105 |
} |
107 |
} |
Lines 119-124
subtest 'Create a pickup' => sub {
Link Here
|
119 |
|
121 |
|
120 |
$cp->delete; |
122 |
$cp->delete; |
121 |
|
123 |
|
|
|
124 |
$schedule_dt = $next_monday->set_hour(18)->set_minute(15)->set_second(00); |
125 |
$cp = Koha::CurbsidePickup->new( { %$params, scheduled_pickup_datetime => $schedule_dt } )->store; |
126 |
ok($cp); |
127 |
$cp->delete; |
128 |
|
122 |
# Day is not ok |
129 |
# Day is not ok |
123 |
my $next_tuesday = |
130 |
my $next_tuesday = |
124 |
$today->clone->add( days => ( 2 - $today->day_of_week ) % 7 ); |
131 |
$today->clone->add( days => ( 2 - $today->day_of_week ) % 7 ); |
Lines 137-144
subtest 'Create a pickup' => sub {
Link Here
|
137 |
'Koha::Exceptions::CurbsidePickup::NoMatchingSlots', |
144 |
'Koha::Exceptions::CurbsidePickup::NoMatchingSlots', |
138 |
'Cannot create a pickup on a time without opening slots defined'; |
145 |
'Cannot create a pickup on a time without opening slots defined'; |
139 |
|
146 |
|
140 |
# Day ok, datetime inside the opening slot, but wrong (15:15 for instance) |
147 |
# Day ok, datetime inside the opening slot, but wrong (15:07 for instance) |
141 |
$schedule_dt = $next_monday->set_hour(15)->set_minute(15)->set_second(00); |
148 |
$schedule_dt = $next_monday->set_hour(15)->set_minute(07)->set_second(00); |
142 |
throws_ok { |
149 |
throws_ok { |
143 |
Koha::CurbsidePickup->new({%$params, scheduled_pickup_datetime => $schedule_dt})->store; |
150 |
Koha::CurbsidePickup->new({%$params, scheduled_pickup_datetime => $schedule_dt})->store; |
144 |
} |
151 |
} |
145 |
- |
|
|