|
Lines 118-124
subtest 'list_updates() tests' => sub {
Link Here
|
| 118 |
|
118 |
|
| 119 |
subtest 'add_update() tests' => sub { |
119 |
subtest 'add_update() tests' => sub { |
| 120 |
|
120 |
|
| 121 |
plan tests => 34; |
121 |
plan tests => 37; |
| 122 |
|
122 |
|
| 123 |
$schema->storage->txn_begin; |
123 |
$schema->storage->txn_begin; |
| 124 |
|
124 |
|
|
Lines 145-151
subtest 'add_update() tests' => sub {
Link Here
|
| 145 |
my $ticket = $builder->build_object( |
145 |
my $ticket = $builder->build_object( |
| 146 |
{ |
146 |
{ |
| 147 |
class => 'Koha::Tickets', |
147 |
class => 'Koha::Tickets', |
| 148 |
value => { reporter_id => $patron->id } |
148 |
value => { |
|
|
149 |
reporter_id => $patron->id, |
| 150 |
resolver_id => undef, |
| 151 |
resolved_date => undef, |
| 152 |
status => 'new' |
| 153 |
} |
| 149 |
} |
154 |
} |
| 150 |
); |
155 |
); |
| 151 |
my $ticket_id = $ticket->id; |
156 |
my $ticket_id = $ticket->id; |
|
Lines 233-239
subtest 'add_update() tests' => sub {
Link Here
|
| 233 |
); |
238 |
); |
| 234 |
$THE_notice->delete; |
239 |
$THE_notice->delete; |
| 235 |
|
240 |
|
|
|
241 |
# Check that state change triggers correct notice |
| 236 |
$update->{state} = 'resolved'; |
242 |
$update->{state} = 'resolved'; |
|
|
243 |
$update->{status} = 'TEST'; |
| 237 |
$update_id = |
244 |
$update_id = |
| 238 |
$t->post_ok( |
245 |
$t->post_ok( |
| 239 |
"//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => |
246 |
"//$userid:$password@/api/v1/tickets/$ticket_id/updates" => json => |
|
Lines 253-257
subtest 'add_update() tests' => sub {
Link Here
|
| 253 |
'Notice queued was a TICKET_RESOLVED for status changing update' |
260 |
'Notice queued was a TICKET_RESOLVED for status changing update' |
| 254 |
); |
261 |
); |
| 255 |
|
262 |
|
|
|
263 |
# Check that state change is carried over to ticket |
| 264 |
$ticket = $ticket->get_from_storage; |
| 265 |
is( |
| 266 |
$ticket->resolver_id, $librarian->id, |
| 267 |
"Ticket was given resolver_id matching the librarian id of the update when state was changed to 'resolved'" |
| 268 |
); |
| 269 |
isnt( $ticket->resolved_date, undef, "Ticket was given resolved_date when state was updated to 'resolved'" ); |
| 270 |
|
| 271 |
# Check that status change is carried over to ticket |
| 272 |
is( |
| 273 |
$ticket->status, 'TEST', |
| 274 |
"Ticket status was updated in line with status change in update" |
| 275 |
); |
| 276 |
|
| 256 |
$schema->storage->txn_rollback; |
277 |
$schema->storage->txn_rollback; |
| 257 |
}; |
278 |
}; |
| 258 |
- |
|
|