|
Lines 169-175
subtest 'Working with related objects' => sub {
Link Here
|
| 169 |
|
169 |
|
| 170 |
subtest 'Status Graph tests' => sub { |
170 |
subtest 'Status Graph tests' => sub { |
| 171 |
|
171 |
|
| 172 |
plan tests => 4; |
172 |
plan tests => 5; |
| 173 |
|
173 |
|
| 174 |
$schema->storage->txn_begin; |
174 |
$schema->storage->txn_begin; |
| 175 |
|
175 |
|
|
Lines 226-231
subtest 'Status Graph tests' => sub {
Link Here
|
| 226 |
"REQ atom + linking QER = cyclical status graph" |
226 |
"REQ atom + linking QER = cyclical status graph" |
| 227 |
); |
227 |
); |
| 228 |
|
228 |
|
|
|
229 |
# Create a new node, with no prev_actions and no next_actions. This should |
| 230 |
# protect us against regressions related to bug 22280. |
| 231 |
my $new_node = { |
| 232 |
TEST => { |
| 233 |
prev_actions => [ ], |
| 234 |
id => 'TEST', |
| 235 |
next_actions => [ ], |
| 236 |
}, |
| 237 |
}; |
| 238 |
# Add the new node to the core_status_grpah |
| 239 |
my $new_graph = $illrq_obj->_status_graph_union( $new_node, $illrq_obj->_core_status_graph); |
| 240 |
# Compare the updated graph to the expected graph |
| 241 |
# The structure we compare against here is just a copy of the structure found |
| 242 |
# in Koha::Illrequest::_core_status_graph() + the new node we created above |
| 243 |
is_deeply( $new_graph, |
| 244 |
{ |
| 245 |
NEW => { |
| 246 |
prev_actions => [ ], # Actions containing buttons |
| 247 |
# leading to this status |
| 248 |
id => 'NEW', # ID of this status |
| 249 |
name => 'New request', # UI name of this status |
| 250 |
ui_method_name => 'New request', # UI name of method leading |
| 251 |
# to this status |
| 252 |
method => 'create', # method to this status |
| 253 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], # buttons to add to all |
| 254 |
# requests with this status |
| 255 |
ui_method_icon => 'fa-plus', # UI Style class |
| 256 |
}, |
| 257 |
REQ => { |
| 258 |
prev_actions => [ 'NEW', 'REQREV', 'QUEUED', 'CANCREQ' ], |
| 259 |
id => 'REQ', |
| 260 |
name => 'Requested', |
| 261 |
ui_method_name => 'Confirm request', |
| 262 |
method => 'confirm', |
| 263 |
next_actions => [ 'REQREV', 'COMP' ], |
| 264 |
ui_method_icon => 'fa-check', |
| 265 |
}, |
| 266 |
GENREQ => { |
| 267 |
prev_actions => [ 'NEW', 'REQREV' ], |
| 268 |
id => 'GENREQ', |
| 269 |
name => 'Requested from partners', |
| 270 |
ui_method_name => 'Place request with partners', |
| 271 |
method => 'generic_confirm', |
| 272 |
next_actions => [ 'COMP' ], |
| 273 |
ui_method_icon => 'fa-send-o', |
| 274 |
}, |
| 275 |
REQREV => { |
| 276 |
prev_actions => [ 'REQ' ], |
| 277 |
id => 'REQREV', |
| 278 |
name => 'Request reverted', |
| 279 |
ui_method_name => 'Revert Request', |
| 280 |
method => 'cancel', |
| 281 |
next_actions => [ 'REQ', 'GENREQ', 'KILL' ], |
| 282 |
ui_method_icon => 'fa-times', |
| 283 |
}, |
| 284 |
TEST => { |
| 285 |
prev_actions => [ ], |
| 286 |
id => 'TEST', |
| 287 |
next_actions => [ ], |
| 288 |
}, |
| 289 |
QUEUED => { |
| 290 |
prev_actions => [ ], |
| 291 |
id => 'QUEUED', |
| 292 |
name => 'Queued request', |
| 293 |
ui_method_name => 0, |
| 294 |
method => 0, |
| 295 |
next_actions => [ 'REQ', 'KILL' ], |
| 296 |
ui_method_icon => 0, |
| 297 |
}, |
| 298 |
CANCREQ => { |
| 299 |
prev_actions => [ 'NEW' ], |
| 300 |
id => 'CANCREQ', |
| 301 |
name => 'Cancellation requested', |
| 302 |
ui_method_name => 0, |
| 303 |
method => 0, |
| 304 |
next_actions => [ 'KILL', 'REQ' ], |
| 305 |
ui_method_icon => 0, |
| 306 |
}, |
| 307 |
COMP => { |
| 308 |
prev_actions => [ 'REQ' ], |
| 309 |
id => 'COMP', |
| 310 |
name => 'Completed', |
| 311 |
ui_method_name => 'Mark completed', |
| 312 |
method => 'mark_completed', |
| 313 |
next_actions => [ ], |
| 314 |
ui_method_icon => 'fa-check', |
| 315 |
}, |
| 316 |
KILL => { |
| 317 |
prev_actions => [ 'QUEUED', 'REQREV', 'NEW', 'CANCREQ' ], |
| 318 |
id => 'KILL', |
| 319 |
name => 0, |
| 320 |
ui_method_name => 'Delete request', |
| 321 |
method => 'delete', |
| 322 |
next_actions => [ ], |
| 323 |
ui_method_icon => 'fa-trash', |
| 324 |
}, |
| 325 |
}, |
| 326 |
"new node + core_status_graph = bigger status graph" |
| 327 |
) || diag explain $new_graph; |
| 328 |
|
| 229 |
$schema->storage->txn_rollback; |
329 |
$schema->storage->txn_rollback; |
| 230 |
}; |
330 |
}; |
| 231 |
|
331 |
|
| 232 |
- |
|
|