Lines 19-27
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 1; |
22 |
use Test::More tests => 2; |
23 |
|
23 |
|
24 |
use Koha::Database; |
24 |
use Koha::Database; |
|
|
25 |
use Koha::AdditionalContents; |
25 |
use Koha::SMTP::Servers; |
26 |
use Koha::SMTP::Servers; |
26 |
|
27 |
|
27 |
use t::lib::TestBuilder; |
28 |
use t::lib::TestBuilder; |
Lines 93-95
subtest 'smtp_server() tests' => sub {
Link Here
|
93 |
|
94 |
|
94 |
$schema->storage->txn_rollback; |
95 |
$schema->storage->txn_rollback; |
95 |
}; |
96 |
}; |
96 |
- |
97 |
|
|
|
98 |
subtest 'opac_info tests' => sub { |
99 |
plan tests => 8; |
100 |
$schema->storage->txn_begin; |
101 |
my $library01 = $builder->build_object({ class => 'Koha::Libraries' }); |
102 |
my $library02 = $builder->build_object({ class => 'Koha::Libraries' }); |
103 |
|
104 |
my $html01 = $builder->build_object({ |
105 |
class => 'Koha::AdditionalContents', |
106 |
value => { category => 'html_customizations', location => 'OpacLibraryInfo', branchcode => undef, lang => 'default', content => '1', expirationdate => undef }, |
107 |
}); |
108 |
my $html02 = $builder->build_object({ |
109 |
class => 'Koha::AdditionalContents', |
110 |
value => { category => 'html_customizations', location => 'OpacLibraryInfo', branchcode => $library01->id, lang => 'default', content => '2', expirationdate => undef }, |
111 |
}); |
112 |
my $html03 = $builder->build_object({ |
113 |
class => 'Koha::AdditionalContents', |
114 |
value => { category => 'html_customizations', location => 'OpacLibraryInfo', branchcode => $library01->id, lang => 'nl-NL', content => '3', expirationdate => undef }, |
115 |
}); |
116 |
my $html04 = $builder->build_object({ |
117 |
class => 'Koha::AdditionalContents', |
118 |
value => { category => 'html_customizations', location => 'OpacLibraryInfo', branchcode => undef, lang => 'fr-FR', content => '4', expirationdate => undef }, |
119 |
}); |
120 |
|
121 |
# Start testing |
122 |
is( $library01->opac_info->content, '2', 'specific library, default language' ); |
123 |
is( $library01->opac_info({ lang => 'nl-NL' })->content, '3', 'specific library, specific language' ); |
124 |
is( $library01->opac_info({ lang => 'nl-BE' })->content, '2', 'specific library, unknown language' ); |
125 |
is( $library02->opac_info->content, '1', 'unknown library, default language' ); |
126 |
is( $library02->opac_info({ lang => 'fr-FR' })->content, '4', 'unknown library, specific language' ); |
127 |
is( $library02->opac_info({ lang => 'de-DE' })->content, '1', 'unknown library, unknown language' ); |
128 |
$html01->delete; |
129 |
is( $library02->opac_info, undef, 'unknown library, default language (after removing html01)' ); |
130 |
is( $library02->opac_info({ lang => 'de-DE' }), undef, 'unknown library, unknown language (after removing html01)' ); |
131 |
|
132 |
$schema->storage->txn_rollback; |
133 |
}; |