Koha/t/db_dependent/yaml.t
Jonathan Druart 84410a1125 Bug 22824: Adjust tests to match final behaviours
Finally we diverge quite a lot with how it worked prior to this patch
set. Reflect the changes in the tests

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-03-04 16:18:42 +01:00

74 lines
1.4 KiB
Perl
Executable file

use Modern::Perl;
use Test::More;
use YAML::XS;
use Template;
use Encode;
use utf8;
my $template = Template->new( ENCODING => 'UTF-8' );
my $vars;
my $output;
$template->process( 't/db_dependent/data/syspref.pref', $vars, \$output );
my $yaml = YAML::XS::Load( Encode::encode_utf8( $output ) );
my $syspref_1 = $yaml->{Test}->{Testing}->[0];
my $syspref_2 = $yaml->{Test}->{Testing}->[1];
my $syspref_3 = $yaml->{Test}->{Testing}->[2];
my $syspref_4 = $yaml->{Test}->{Testing}->[3];
is_deeply(
$syspref_1,
[
"Do it",
{
choices => {
on => "certainly",
off => "I don't think so"
},
pref => "syspref_1"
}
]
);
is_deeply(
$syspref_2,
[
{
choices => {
0 => "really don't do",
'' => "Do",
dont => "Don't do"
},
pref => "syspref_2"
},
"it."
]
);
is_deeply(
$syspref_3,
[
"We love unicode",
{
choices => {
no => "Not really",
'★' => "❤️"
},
pref => "syspref_3"
}
],
);
is_deeply(
$syspref_4,
[
"List of fields",
{
choices => {
16 => 16,
"020" => "020",
123 => 123
},
pref => "syspref_4"
}
]
);
done_testing;