Bug 29454: (follow-up) Cover more test cases

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2022-06-15 12:08:05 +00:00 committed by Tomas Cohen Arazi
parent 338ca787be
commit 75fe055dcc
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 22 additions and 1 deletions

View File

@ -16,7 +16,7 @@
use Modern::Perl;
use Test::More tests => 8;
use Test::More tests => 10;
use C4::Context;
use Koha::Database;
@ -77,6 +77,15 @@ Koha::Localization->new(
translation => 'Translated itemtype B'
}
)->store;
my $itemtypeC = $builder->build_object(
{
class => 'Koha::ItemTypes',
value => {
parent_type => undef,
description => "Desc itemtype C",
}
}
);
my $GetDescriptionA1 = $plugin->GetDescription($itemtypeA->itemtype);
is($GetDescriptionA1, "Translated itemtype A", "ItemType without parent - GetDescription without want parent");
@ -88,6 +97,18 @@ is($GetDescriptionB1, "Translated itemtype B", "ItemType with parent - GetDescri
my $GetDescriptionB2 = $plugin->GetDescription($itemtypeB->itemtype, 1);
is($GetDescriptionB2, "Translated itemtype A->Translated itemtype B", "ItemType with parent - GetDescription with want parent");
my $GetDescriptionC1 = $plugin->GetDescription($itemtypeC->itemtype);
is($GetDescriptionC1, "Desc itemtype C", "ItemType without parent - GetDescription without want parent - No translation");
$itemtypeC->description("New desc itemtype C")->store();
# For normal (web) requests cache is flushed - pretend we did here
my $memory_cache = Koha::Cache::Memory::Lite->get_instance();
$memory_cache->flush;
$GetDescriptionC1 = $plugin->GetDescription($itemtypeC->itemtype);
is($GetDescriptionC1, "New desc itemtype C", "ItemType without parent - GetDescription without want parent - No translation - updated value returned");
$schema->storage->txn_rollback;
1;