From 6c11a086d3b18da34f9dcae50a4e70382ce6bd60 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Tue, 7 Jan 2020 14:45:41 -0300 Subject: [PATCH] Bug 24366: Unit tests Signed-off-by: Kyle M Hall --- t/db_dependent/Koha/Biblio.t | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 06a5b40a52..45b375b369 100644 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 8; +use Test::More tests => 9; use C4::Biblio; use Koha::Database; @@ -434,3 +434,20 @@ subtest 'pickup_locations' => sub { $schema->storage->txn_rollback; }; + +subtest 'to_api() tests' => sub { + + $schema->storage->txn_begin; + + my $biblio = $builder->build_sample_biblio(); + my $biblioitem_api = $biblio->biblioitem->to_api; + my $biblio_api = $biblio->to_api; + + plan tests => scalar keys %{ $biblioitem_api }; + + foreach my $key ( keys %{ $biblioitem_api } ) { + is( $biblio_api->{$key}, $biblioitem_api->{$key}, "$key is added to the biblio object" ); + } + + $schema->storage->txn_rollback; +}; -- 2.21.0 (Apple Git-122.2)