Lines 190-196
subtest 'Working with related objects' => sub {
Link Here
|
190 |
|
190 |
|
191 |
subtest 'Status Graph tests' => sub { |
191 |
subtest 'Status Graph tests' => sub { |
192 |
|
192 |
|
193 |
plan tests => 5; |
193 |
plan tests => 6; |
194 |
|
194 |
|
195 |
$schema->storage->txn_begin; |
195 |
$schema->storage->txn_begin; |
196 |
|
196 |
|
Lines 368-373
subtest 'Status Graph tests' => sub {
Link Here
|
368 |
"new node + core_status_graph = bigger status graph" |
368 |
"new node + core_status_graph = bigger status graph" |
369 |
) || diag explain $new_graph; |
369 |
) || diag explain $new_graph; |
370 |
|
370 |
|
|
|
371 |
# Create a duplicate node |
372 |
my $dupe_node = { |
373 |
REQ => { |
374 |
prev_actions => [ 'NEW', 'REQREV', 'QUEUED', 'CANCREQ' ], |
375 |
id => 'REQ', |
376 |
name => 'Requested', |
377 |
ui_method_name => 'Confirm request dupe', |
378 |
method => 'confirm', |
379 |
next_actions => [ 'REQREV', 'COMP', 'CHK' ], |
380 |
ui_method_icon => 'fa-check', |
381 |
} |
382 |
}; |
383 |
# Add the dupe node to the core_status_grpah |
384 |
my $dupe_graph = $illrq_obj->_status_graph_union( $illrq_obj->_core_status_graph, $dupe_node); |
385 |
# Compare the updated graph to the expected graph |
386 |
# The structure we compare against here is just a copy of the structure found |
387 |
# in Koha::Illrequest::_core_status_graph() + the new node we created above |
388 |
cmp_deeply( $dupe_graph, |
389 |
{ |
390 |
NEW => { |
391 |
prev_actions => [ ], # Actions containing buttons |
392 |
# leading to this status |
393 |
id => 'NEW', # ID of this status |
394 |
name => 'New request', # UI name of this status |
395 |
ui_method_name => 'New request', # UI name of method leading |
396 |
# to this status |
397 |
method => 'create', # method to this status |
398 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], # buttons to add to all |
399 |
# requests with this status |
400 |
ui_method_icon => 'fa-plus', # UI Style class |
401 |
}, |
402 |
REQ => { |
403 |
prev_actions => [ 'NEW', 'REQREV', 'QUEUED', 'CANCREQ' ], |
404 |
id => 'REQ', |
405 |
name => 'Requested', |
406 |
ui_method_name => 'Confirm request dupe', |
407 |
method => 'confirm', |
408 |
next_actions => [ 'REQREV', 'COMP', 'CHK' ], |
409 |
ui_method_icon => 'fa-check', |
410 |
}, |
411 |
GENREQ => { |
412 |
prev_actions => [ 'NEW', 'REQREV' ], |
413 |
id => 'GENREQ', |
414 |
name => 'Requested from partners', |
415 |
ui_method_name => 'Place request with partners', |
416 |
method => 'generic_confirm', |
417 |
next_actions => [ 'COMP', 'CHK' ], |
418 |
ui_method_icon => 'fa-send-o', |
419 |
}, |
420 |
REQREV => { |
421 |
prev_actions => [ 'REQ' ], |
422 |
id => 'REQREV', |
423 |
name => 'Request reverted', |
424 |
ui_method_name => 'Revert Request', |
425 |
method => 'cancel', |
426 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], |
427 |
ui_method_icon => 'fa-times', |
428 |
}, |
429 |
QUEUED => { |
430 |
prev_actions => [ ], |
431 |
id => 'QUEUED', |
432 |
name => 'Queued request', |
433 |
ui_method_name => 0, |
434 |
method => 0, |
435 |
next_actions => [ 'REQ', 'KILL' ], |
436 |
ui_method_icon => 0, |
437 |
}, |
438 |
CANCREQ => { |
439 |
prev_actions => [ 'NEW' ], |
440 |
id => 'CANCREQ', |
441 |
name => 'Cancellation requested', |
442 |
ui_method_name => 0, |
443 |
method => 0, |
444 |
next_actions => [ 'KILL', 'REQ' ], |
445 |
ui_method_icon => 0, |
446 |
}, |
447 |
COMP => { |
448 |
prev_actions => [ 'REQ' ], |
449 |
id => 'COMP', |
450 |
name => 'Completed', |
451 |
ui_method_name => 'Mark completed', |
452 |
method => 'mark_completed', |
453 |
next_actions => [ 'CHK' ], |
454 |
ui_method_icon => 'fa-check', |
455 |
}, |
456 |
KILL => { |
457 |
prev_actions => [ 'QUEUED', 'REQREV', 'NEW', 'CANCREQ' ], |
458 |
id => 'KILL', |
459 |
name => 0, |
460 |
ui_method_name => 'Delete request', |
461 |
method => 'delete', |
462 |
next_actions => [ ], |
463 |
ui_method_icon => 'fa-trash', |
464 |
}, |
465 |
CHK => { |
466 |
prev_actions => [ 'REQ', 'GENREQ', 'COMP' ], |
467 |
id => 'CHK', |
468 |
name => 'Checked out', |
469 |
ui_method_name => 'Check out', |
470 |
needs_prefs => [ 'CirculateILL' ], |
471 |
needs_perms => [ 'user_circulate_circulate_remaining_permissions' ], |
472 |
needs_all => ignore(), |
473 |
method => 'check_out', |
474 |
next_actions => [ ], |
475 |
ui_method_icon => 'fa-upload', |
476 |
}, |
477 |
RET => { |
478 |
prev_actions => [ 'CHK' ], |
479 |
id => 'RET', |
480 |
name => 'Returned to library', |
481 |
ui_method_name => 'Check in', |
482 |
method => 'check_in', |
483 |
next_actions => [ 'COMP' ], |
484 |
ui_method_icon => 'fa-download', |
485 |
} |
486 |
}, |
487 |
"new node + core_status_graph = bigger status graph" |
488 |
) || diag explain $dupe_graph; |
489 |
|
371 |
$schema->storage->txn_rollback; |
490 |
$schema->storage->txn_rollback; |
372 |
}; |
491 |
}; |
373 |
|
492 |
|
374 |
- |
|
|