|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 9; |
20 |
use Test::More tests => 10; |
| 21 |
|
21 |
|
| 22 |
use C4::Biblio; |
22 |
use C4::Biblio; |
| 23 |
use Koha::Database; |
23 |
use Koha::Database; |
|
Lines 456-458
subtest 'to_api() tests' => sub {
Link Here
|
| 456 |
|
456 |
|
| 457 |
$schema->storage->txn_rollback; |
457 |
$schema->storage->txn_rollback; |
| 458 |
}; |
458 |
}; |
| 459 |
- |
459 |
|
|
|
460 |
subtest 'suggestions() tests' => sub { |
| 461 |
|
| 462 |
plan tests => 3; |
| 463 |
|
| 464 |
$schema->storage->txn_begin; |
| 465 |
|
| 466 |
my $biblio = $builder->build_sample_biblio(); |
| 467 |
|
| 468 |
is( ref($biblio->suggestions), 'Koha::Suggestions', 'Return type is correct' ); |
| 469 |
|
| 470 |
is_deeply( |
| 471 |
$biblio->suggestions->unblessed, |
| 472 |
[], |
| 473 |
'->suggestions returns an empty Koha::Suggestions resultset' |
| 474 |
); |
| 475 |
|
| 476 |
my $suggestion = $builder->build_object( |
| 477 |
{ |
| 478 |
class => 'Koha::Suggestions', |
| 479 |
value => { biblionumber => $biblio->biblionumber } |
| 480 |
} |
| 481 |
); |
| 482 |
|
| 483 |
my $suggestions = $biblio->suggestions->unblessed; |
| 484 |
|
| 485 |
is_deeply( |
| 486 |
$biblio->suggestions->unblessed, |
| 487 |
[ $suggestion->unblessed ], |
| 488 |
'->suggestions returns the related Koha::Suggestion objects' |
| 489 |
); |
| 490 |
|
| 491 |
$schema->storage->txn_rollback; |
| 492 |
}; |