|
Lines 16-22
Link Here
|
| 16 |
|
16 |
|
| 17 |
use Modern::Perl; |
17 |
use Modern::Perl; |
| 18 |
|
18 |
|
| 19 |
use Test::More tests => 8; |
19 |
use Test::More tests => 10; |
| 20 |
|
20 |
|
| 21 |
use C4::Context; |
21 |
use C4::Context; |
| 22 |
use Koha::Database; |
22 |
use Koha::Database; |
|
Lines 77-82
Koha::Localization->new(
Link Here
|
| 77 |
translation => 'Translated itemtype B' |
77 |
translation => 'Translated itemtype B' |
| 78 |
} |
78 |
} |
| 79 |
)->store; |
79 |
)->store; |
|
|
80 |
my $itemtypeC = $builder->build_object( |
| 81 |
{ |
| 82 |
class => 'Koha::ItemTypes', |
| 83 |
value => { |
| 84 |
parent_type => undef, |
| 85 |
description => "Desc itemtype C", |
| 86 |
} |
| 87 |
} |
| 88 |
); |
| 80 |
|
89 |
|
| 81 |
my $GetDescriptionA1 = $plugin->GetDescription($itemtypeA->itemtype); |
90 |
my $GetDescriptionA1 = $plugin->GetDescription($itemtypeA->itemtype); |
| 82 |
is($GetDescriptionA1, "Translated itemtype A", "ItemType without parent - GetDescription without want parent"); |
91 |
is($GetDescriptionA1, "Translated itemtype A", "ItemType without parent - GetDescription without want parent"); |
|
Lines 88-93
is($GetDescriptionB1, "Translated itemtype B", "ItemType with parent - GetDescri
Link Here
|
| 88 |
my $GetDescriptionB2 = $plugin->GetDescription($itemtypeB->itemtype, 1); |
97 |
my $GetDescriptionB2 = $plugin->GetDescription($itemtypeB->itemtype, 1); |
| 89 |
is($GetDescriptionB2, "Translated itemtype A->Translated itemtype B", "ItemType with parent - GetDescription with want parent"); |
98 |
is($GetDescriptionB2, "Translated itemtype A->Translated itemtype B", "ItemType with parent - GetDescription with want parent"); |
| 90 |
|
99 |
|
|
|
100 |
my $GetDescriptionC1 = $plugin->GetDescription($itemtypeC->itemtype); |
| 101 |
is($GetDescriptionC1, "Desc itemtype C", "ItemType without parent - GetDescription without want parent - No translation"); |
| 102 |
|
| 103 |
$itemtypeC->description("New desc itemtype C")->store(); |
| 104 |
|
| 105 |
# For normal (web) requests cache is flushed - pretend we did here |
| 106 |
my $memory_cache = Koha::Cache::Memory::Lite->get_instance(); |
| 107 |
$memory_cache->flush; |
| 108 |
|
| 109 |
$GetDescriptionC1 = $plugin->GetDescription($itemtypeC->itemtype); |
| 110 |
is($GetDescriptionC1, "New desc itemtype C", "ItemType without parent - GetDescription without want parent - No translation - updated value returned"); |
| 111 |
|
| 91 |
$schema->storage->txn_rollback; |
112 |
$schema->storage->txn_rollback; |
| 92 |
|
113 |
|
| 93 |
1; |
114 |
1; |
| 94 |
- |
|
|