Bug 24418: Unit tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
4c10b49b5d
commit
000cf4eba3
1 changed files with 35 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 10;
|
||||
|
||||
use C4::Biblio;
|
||||
use Koha::Database;
|
||||
|
@ -456,3 +456,37 @@ subtest 'to_api() tests' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'suggestions() tests' => sub {
|
||||
|
||||
plan tests => 3;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $biblio = $builder->build_sample_biblio();
|
||||
|
||||
is( ref($biblio->suggestions), 'Koha::Suggestions', 'Return type is correct' );
|
||||
|
||||
is_deeply(
|
||||
$biblio->suggestions->unblessed,
|
||||
[],
|
||||
'->suggestions returns an empty Koha::Suggestions resultset'
|
||||
);
|
||||
|
||||
my $suggestion = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Suggestions',
|
||||
value => { biblionumber => $biblio->biblionumber }
|
||||
}
|
||||
);
|
||||
|
||||
my $suggestions = $biblio->suggestions->unblessed;
|
||||
|
||||
is_deeply(
|
||||
$biblio->suggestions->unblessed,
|
||||
[ $suggestion->unblessed ],
|
||||
'->suggestions returns the related Koha::Suggestion objects'
|
||||
);
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue