View | Details | Raw Unified | Return to bug 28327
Collapse All | Expand All

(-)a/t/Context.t (-1 / +18 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use DBI;
20
use DBI;
21
use Test::More tests => 31;
21
use Test::More tests => 32;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Warn;
23
use Test::Warn;
24
use YAML::XS;
24
use YAML::XS;
Lines 63-68 subtest 'needs_install() tests' => sub { Link Here
63
    is( C4::Context->needs_install, 1, "->preference(Version) is not defined, need to install" );
63
    is( C4::Context->needs_install, 1, "->preference(Version) is not defined, need to install" );
64
};
64
};
65
65
66
subtest 'csv_delimiter() tests' => sub {
67
68
    plan tests => 4;
69
70
    t::lib::Mocks::mock_preference( 'CSVDelimiter', undef );
71
    is( C4::Context->csv_delimiter, ';', "csv_delimiter returns semicolon if system preference CSVDelimiter is undefined" );
72
73
    t::lib::Mocks::mock_preference( 'CSVDelimiter', '' );
74
    is( C4::Context->csv_delimiter, ';', "csv_delimiter returns semicolon if system preference CSVDelimiter is empty string" );
75
76
    t::lib::Mocks::mock_preference( 'CSVDelimiter', ',' );
77
    is( C4::Context->csv_delimiter, ',', "csv_delimiter returns comma if system preference CSVDelimiter is comma" );
78
79
    t::lib::Mocks::mock_preference( 'CSVDelimiter', 'tabulation' );
80
    is( C4::Context->csv_delimiter, "\t", "csv_delimiter returns '\t' if system preference CSVDelimiter is tabulation" );
81
};
82
66
my $context = Test::MockModule->new('C4::Context');
83
my $context = Test::MockModule->new('C4::Context');
67
my $userenv = {};
84
my $userenv = {};
68
85
(-)a/t/Koha_Template_Plugin_Koha.t (-2 / +26 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 4;
20
use Test::More tests => 5;
21
use Test::MockModule;
21
use Test::MockModule;
22
use t::lib::Mocks;
22
use t::lib::Mocks;
23
23
Lines 88-90 subtest "Koha::Template::Plugin::Koha::ArePluginsEnabled tests" => sub { Link Here
88
    is(Koha::Template::Plugin::Koha::ArePluginsEnabled(), 0, "Correct ArePluginsEnabled is no");
88
    is(Koha::Template::Plugin::Koha::ArePluginsEnabled(), 0, "Correct ArePluginsEnabled is no");
89
89
90
};
90
};
91
- 
91
92
subtest "Koha::Template::Plugin::Koha::CSVDelimiter tests" => sub {
93
94
    plan tests => 8;
95
96
    my $plugin = Koha::Template::Plugin::Koha->new();
97
98
    t::lib::Mocks::mock_preference('CSVDelimiter', '');
99
    is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is empty string");
100
101
    t::lib::Mocks::mock_preference('CSVDelimiter', undef);
102
    is($plugin->CSVDelimiter(), ',', "CSVDelimiter() returns comma when preference is undefined");
103
104
    t::lib::Mocks::mock_preference('CSVDelimiter', ';');
105
    is($plugin->CSVDelimiter(), ';', "CSVDelimiter() returns preference value when preference is not tabulation");
106
107
    t::lib::Mocks::mock_preference('CSVDelimiter', 'tabulation');
108
    is($plugin->CSVDelimiter(), "\t", "CSVDelimiter() returns \\t when preference is tabulation");
109
110
    t::lib::Mocks::mock_preference('CSVDelimiter', '#');
111
    is($plugin->CSVDelimiter(undef), '#', "CSVDelimiter(arg) returns preference value when arg is undefined");
112
    is($plugin->CSVDelimiter(''), '#', "CSVDelimiter(arg) returns preference value when arg is empty string");
113
    is($plugin->CSVDelimiter(','), ',', "CSVDelimiter(arg) returns arg value when arg is not tabulation");
114
    is($plugin->CSVDelimiter('tabulation'), "\t", "CSVDelimiter(arg) returns \\t value when arg is tabulation");
115
};

Return to bug 28327