Bug 42447: Add unit tests
PA amended: Removed bug number from subtest Signed-off-by: Charlie Arthur <carthur@slolibrary.org> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
7693360a0f
commit
f0a4659e3c
|
|
@ -18,7 +18,7 @@
|
|||
use Modern::Perl;
|
||||
|
||||
use Test::NoWarnings;
|
||||
use Test::More tests => 9;
|
||||
use Test::More tests => 10;
|
||||
|
||||
use Koha::SIP2::Accounts;
|
||||
use Koha::Database;
|
||||
|
|
@ -246,3 +246,42 @@ subtest 'system_preference_overrides' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'template fields accept long text' => sub {
|
||||
|
||||
plan tests => 5;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $template = '[% patron.surname %], [% patron.firstname %] ' . ( 'x' x 1000 );
|
||||
|
||||
my $account = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::SIP2::Accounts',
|
||||
value => {
|
||||
ae_field_template => $template,
|
||||
av_field_template => $template,
|
||||
da_field_template => $template,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
my $stored = $account->get_from_storage;
|
||||
is( $stored->ae_field_template, $template, 'ae_field_template can store large templates' );
|
||||
is( $stored->av_field_template, $template, 'av_field_template can store large templates' );
|
||||
is( $stored->da_field_template, $template, 'da_field_template can store large templates' );
|
||||
|
||||
$account->custom_item_fields( [ { field => 'IN', template => $template } ] );
|
||||
$account->custom_patron_fields( [ { field => 'DE', template => $template } ] );
|
||||
|
||||
is(
|
||||
$account->custom_item_fields->next->template, $template,
|
||||
'custom_item_fields.template can store large templates'
|
||||
);
|
||||
is(
|
||||
$account->custom_patron_fields->next->template, $template,
|
||||
'custom_patron_fields.template can store large templates'
|
||||
);
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue