|
Lines 272-279
subtest 'constraints' => sub {
Link Here
|
| 272 |
$schema->storage->txn_rollback; |
272 |
$schema->storage->txn_rollback; |
| 273 |
}; |
273 |
}; |
| 274 |
|
274 |
|
| 275 |
subtest 'manager, suggester, rejecter, last_modifier' => sub { |
275 |
subtest 'manager, suggester, accepter, rejecter, last_modifier' => sub { |
| 276 |
plan tests => 8; |
276 |
plan tests => 11; |
| 277 |
$schema->storage->txn_begin; |
277 |
$schema->storage->txn_begin; |
| 278 |
|
278 |
|
| 279 |
my $suggestion = $builder->build_object( { class => 'Koha::Suggestions' } ); |
279 |
my $suggestion = $builder->build_object( { class => 'Koha::Suggestions' } ); |
|
Lines 288-293
subtest 'manager, suggester, rejecter, last_modifier' => sub {
Link Here
|
| 288 |
'Koha::Patron', |
288 |
'Koha::Patron', |
| 289 |
'->rejecter should have returned a Koha::Patron object' |
289 |
'->rejecter should have returned a Koha::Patron object' |
| 290 |
); |
290 |
); |
|
|
291 |
is( |
| 292 |
ref( $suggestion->accepter ), |
| 293 |
'Koha::Patron', |
| 294 |
'->accepter should have returned a Koha::Patron object' |
| 295 |
); |
| 291 |
is( |
296 |
is( |
| 292 |
ref( $suggestion->suggester ), |
297 |
ref( $suggestion->suggester ), |
| 293 |
'Koha::Patron', |
298 |
'Koha::Patron', |
|
Lines 303-308
subtest 'manager, suggester, rejecter, last_modifier' => sub {
Link Here
|
| 303 |
{ |
308 |
{ |
| 304 |
managedby => undef, |
309 |
managedby => undef, |
| 305 |
rejectedby => undef, |
310 |
rejectedby => undef, |
|
|
311 |
acceptedby => undef, |
| 306 |
suggestedby => undef, |
312 |
suggestedby => undef, |
| 307 |
lastmodificationby => undef |
313 |
lastmodificationby => undef |
| 308 |
} |
314 |
} |
|
Lines 316-321
subtest 'manager, suggester, rejecter, last_modifier' => sub {
Link Here
|
| 316 |
$suggestion->rejecter, undef, |
322 |
$suggestion->rejecter, undef, |
| 317 |
'->rejecter should have returned undef if no rejecter set' |
323 |
'->rejecter should have returned undef if no rejecter set' |
| 318 |
); |
324 |
); |
|
|
325 |
is( |
| 326 |
$suggestion->accepter, undef, |
| 327 |
'->accepter should have returned undef if no rejecter set' |
| 328 |
); |
| 319 |
is( |
329 |
is( |
| 320 |
$suggestion->suggester, undef, |
330 |
$suggestion->suggester, undef, |
| 321 |
'->suggester should have returned undef if no suggester set' |
331 |
'->suggester should have returned undef if no suggester set' |
|
Lines 326-331
subtest 'manager, suggester, rejecter, last_modifier' => sub {
Link Here
|
| 326 |
'->last_modifier should have returned undef if no last_modifier set' |
336 |
'->last_modifier should have returned undef if no last_modifier set' |
| 327 |
); |
337 |
); |
| 328 |
|
338 |
|
|
|
339 |
my $accepter = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 340 |
$suggestion->set( |
| 341 |
{ |
| 342 |
acceptedby => $accepter->id, |
| 343 |
} |
| 344 |
); |
| 345 |
is( $suggestion->accepter->id, $accepter->id, 'Accepter correctly retrieved' ); |
| 329 |
$schema->storage->txn_rollback; |
346 |
$schema->storage->txn_rollback; |
| 330 |
}; |
347 |
}; |
| 331 |
|
348 |
|
| 332 |
- |
|
|