Lines 33-38
use t::lib::TestBuilder;
Link Here
|
33 |
use Test::MockObject; |
33 |
use Test::MockObject; |
34 |
use Test::MockModule; |
34 |
use Test::MockModule; |
35 |
use Test::Exception; |
35 |
use Test::Exception; |
|
|
36 |
use Test::Deep qw/ cmp_deeply ignore /; |
36 |
|
37 |
|
37 |
use Test::More tests => 12; |
38 |
use Test::More tests => 12; |
38 |
|
39 |
|
Lines 120-126
subtest 'Basic object tests' => sub {
Link Here
|
120 |
|
121 |
|
121 |
subtest 'Working with related objects' => sub { |
122 |
subtest 'Working with related objects' => sub { |
122 |
|
123 |
|
123 |
plan tests => 5; |
124 |
plan tests => 7; |
124 |
|
125 |
|
125 |
$schema->storage->txn_begin; |
126 |
$schema->storage->txn_begin; |
126 |
|
127 |
|
Lines 161-166
subtest 'Working with related objects' => sub {
Link Here
|
161 |
is($illrq_obj->illrequestattributes->count + 1, Koha::Illrequestattributes->search->count, |
162 |
is($illrq_obj->illrequestattributes->count + 1, Koha::Illrequestattributes->search->count, |
162 |
"Fetching expected number of Illrequestattributes for our request."); |
163 |
"Fetching expected number of Illrequestattributes for our request."); |
163 |
|
164 |
|
|
|
165 |
is($illrq_obj->biblio, undef, "->biblio returns undef if no biblio"); |
166 |
my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); |
167 |
my $req_bib = $builder->build_object({ |
168 |
class => 'Koha::Illrequests', |
169 |
value => { |
170 |
biblio_id => $biblio->biblionumber |
171 |
} |
172 |
}); |
173 |
isa_ok($req_bib->biblio, 'Koha::Biblio', "OK accessing related biblio"); |
174 |
|
164 |
$illrq_obj->delete; |
175 |
$illrq_obj->delete; |
165 |
is(Koha::Illrequestattributes->search->count, 1, |
176 |
is(Koha::Illrequestattributes->search->count, 1, |
166 |
"Correct number of illrequestattributes after delete."); |
177 |
"Correct number of illrequestattributes after delete."); |
Lines 244-251
subtest 'Status Graph tests' => sub {
Link Here
|
244 |
# Compare the updated graph to the expected graph |
255 |
# Compare the updated graph to the expected graph |
245 |
# The structure we compare against here is just a copy of the structure found |
256 |
# The structure we compare against here is just a copy of the structure found |
246 |
# in Koha::Illrequest::_core_status_graph() + the new node we created above |
257 |
# in Koha::Illrequest::_core_status_graph() + the new node we created above |
247 |
is_deeply( $new_graph, |
258 |
cmp_deeply( $new_graph, |
248 |
{ |
259 |
{ |
|
|
260 |
TEST => { |
261 |
prev_actions => [ ], |
262 |
id => 'TEST', |
263 |
next_actions => [ ], |
264 |
}, |
249 |
NEW => { |
265 |
NEW => { |
250 |
prev_actions => [ ], # Actions containing buttons |
266 |
prev_actions => [ ], # Actions containing buttons |
251 |
# leading to this status |
267 |
# leading to this status |
Lines 264-270
subtest 'Status Graph tests' => sub {
Link Here
|
264 |
name => 'Requested', |
280 |
name => 'Requested', |
265 |
ui_method_name => 'Confirm request', |
281 |
ui_method_name => 'Confirm request', |
266 |
method => 'confirm', |
282 |
method => 'confirm', |
267 |
next_actions => [ 'REQREV', 'COMP' ], |
283 |
next_actions => [ 'REQREV', 'COMP', 'CHK' ], |
268 |
ui_method_icon => 'fa-check', |
284 |
ui_method_icon => 'fa-check', |
269 |
}, |
285 |
}, |
270 |
GENREQ => { |
286 |
GENREQ => { |
Lines 273-279
subtest 'Status Graph tests' => sub {
Link Here
|
273 |
name => 'Requested from partners', |
289 |
name => 'Requested from partners', |
274 |
ui_method_name => 'Place request with partners', |
290 |
ui_method_name => 'Place request with partners', |
275 |
method => 'generic_confirm', |
291 |
method => 'generic_confirm', |
276 |
next_actions => [ 'COMP' ], |
292 |
next_actions => [ 'COMP', 'CHK' ], |
277 |
ui_method_icon => 'fa-send-o', |
293 |
ui_method_icon => 'fa-send-o', |
278 |
}, |
294 |
}, |
279 |
REQREV => { |
295 |
REQREV => { |
Lines 285-295
subtest 'Status Graph tests' => sub {
Link Here
|
285 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], |
301 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], |
286 |
ui_method_icon => 'fa-times', |
302 |
ui_method_icon => 'fa-times', |
287 |
}, |
303 |
}, |
288 |
TEST => { |
|
|
289 |
prev_actions => [ ], |
290 |
id => 'TEST', |
291 |
next_actions => [ ], |
292 |
}, |
293 |
QUEUED => { |
304 |
QUEUED => { |
294 |
prev_actions => [ ], |
305 |
prev_actions => [ ], |
295 |
id => 'QUEUED', |
306 |
id => 'QUEUED', |
Lines 314-320
subtest 'Status Graph tests' => sub {
Link Here
|
314 |
name => 'Completed', |
325 |
name => 'Completed', |
315 |
ui_method_name => 'Mark completed', |
326 |
ui_method_name => 'Mark completed', |
316 |
method => 'mark_completed', |
327 |
method => 'mark_completed', |
317 |
next_actions => [ ], |
328 |
next_actions => [ 'CHK' ], |
318 |
ui_method_icon => 'fa-check', |
329 |
ui_method_icon => 'fa-check', |
319 |
}, |
330 |
}, |
320 |
KILL => { |
331 |
KILL => { |
Lines 326-331
subtest 'Status Graph tests' => sub {
Link Here
|
326 |
next_actions => [ ], |
337 |
next_actions => [ ], |
327 |
ui_method_icon => 'fa-trash', |
338 |
ui_method_icon => 'fa-trash', |
328 |
}, |
339 |
}, |
|
|
340 |
CHK => { |
341 |
prev_actions => [ 'REQ', 'GENREQ', 'COMP' ], |
342 |
id => 'CHK', |
343 |
name => 'Checked out', |
344 |
ui_method_name => 'Check out', |
345 |
needs_prefs => [ 'CirculateILL' ], |
346 |
needs_perms => [ 'user_circulate_circulate_remaining_permissions' ], |
347 |
needs_all => ignore(), |
348 |
method => 'check_out', |
349 |
next_actions => [ ], |
350 |
ui_method_icon => 'fa-upload', |
351 |
}, |
352 |
RET => { |
353 |
prev_actions => [ 'CHK' ], |
354 |
id => 'RET', |
355 |
name => 'Returned to library', |
356 |
ui_method_name => 'Check in', |
357 |
method => 'check_in', |
358 |
next_actions => [ 'COMP' ], |
359 |
ui_method_icon => 'fa-download', |
360 |
} |
329 |
}, |
361 |
}, |
330 |
"new node + core_status_graph = bigger status graph" |
362 |
"new node + core_status_graph = bigger status graph" |
331 |
) || diag explain $new_graph; |
363 |
) || diag explain $new_graph; |
Lines 782-788
subtest 'Checking out' => sub {
Link Here
|
782 |
|
814 |
|
783 |
$schema->storage->txn_begin; |
815 |
$schema->storage->txn_begin; |
784 |
|
816 |
|
785 |
my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); |
817 |
my $itemtype = $builder->build_object({ |
|
|
818 |
class => 'Koha::ItemTypes', |
819 |
value => { |
820 |
notforloan => 1 |
821 |
} |
822 |
}); |
786 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
823 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
787 |
my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); |
824 |
my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); |
788 |
my $patron = $builder->build_object({ |
825 |
my $patron = $builder->build_object({ |
Lines 851-856
subtest 'Checking out' => sub {
Link Here
|
851 |
|
888 |
|
852 |
# Passed validation |
889 |
# Passed validation |
853 |
# |
890 |
# |
|
|
891 |
# We need to mock the user environment for AddIssue |
892 |
t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} }); |
893 |
# |
854 |
# Delete the items we created, so we can test that we can create one |
894 |
# Delete the items we created, so we can test that we can create one |
855 |
Koha::Items->find({ itemnumber => $item1->itemnumber })->delete; |
895 |
Koha::Items->find({ itemnumber => $item1->itemnumber })->delete; |
856 |
Koha::Items->find({ itemnumber => $item2->itemnumber })->delete; |
896 |
Koha::Items->find({ itemnumber => $item2->itemnumber })->delete; |
857 |
- |
|
|