@@ -, +, @@ --- t/db_dependent/Serials.t | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) --- a/t/db_dependent/Serials.t +++ a/t/db_dependent/Serials.t @@ -6,7 +6,6 @@ use Modern::Perl; use YAML; -use CGI qw ( -utf8 ); use C4::Serials; use C4::Serials::Frequency; use C4::Serials::Numberpattern; @@ -16,9 +15,11 @@ use C4::Budgets; use C4::Items; use Koha::DateUtils; use Koha::Acquisition::Booksellers; +use Koha::Subscriptions; +use Koha::AdditionalFields; use t::lib::Mocks; use t::lib::TestBuilder; -use Test::More tests => 46; +use Test::More tests => 47; BEGIN { use_ok('C4::Serials'); @@ -348,6 +349,30 @@ subtest "Do not generate an expected if one already exists" => sub { is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); }; +subtest 'Addition fields for subscription' => sub { + plan tests => 2; + + is( ref($subscription->{additional_fields}), 'HASH'); # Could be a 'Koha::AdditionalFields! + + my $subscription_object = Koha::Subscriptions->find($subscriptionid); + my $foo = Koha::AdditionalField->new({ + tablename => 'subscription', + name => 'subscription_foo', + })->store; + + $subscription_object->set_additional_fields( + [ + { + id => $foo->id, + value => 'foo value for subscription', + } + ] + ); + + my $subscription = C4::Serials::GetSubscription($subscriptionid); + is( ref($subscription->{additional_fields}), 'HASH', 'GetSubscription should build the additional fields'); # Could be a Koha::AdditionalFieldValues +}; + $dbh->rollback; sub get_biblio { --