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

(-)a/t/XSLT.t (-29 / +2 lines)
Lines 16-22 Link Here
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use Test::More;
19
use Test::More tests => 8;
20
20
21
use File::Temp;
21
use File::Temp;
22
use File::Path qw/make_path/;
22
use File::Path qw/make_path/;
Lines 25-52 use t::lib::Mocks; Link Here
25
25
26
use Module::Load::Conditional qw/check_install/;
26
use Module::Load::Conditional qw/check_install/;
27
27
28
BEGIN {
28
use_ok('C4::XSLT');
29
    if ( check_install( module => 'Test::DBIx::Class' ) ) {
30
        plan tests => 10;
31
    } else {
32
        plan skip_all => "Need Test::DBIx::Class"
33
    }
34
35
    use_ok('C4::XSLT');
36
};
37
38
use Test::DBIx::Class {
39
    schema_class => 'Koha::Schema',
40
    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
41
    connect_opts => { name_sep => '.', quote_char => '`', },
42
    fixture_class => '::Populate',
43
}, 'Branch' ;
44
45
fixtures_ok [
46
    Branch => [
47
    ],
48
];
49
50
29
51
my $dir = File::Temp->newdir();
30
my $dir = File::Temp->newdir();
52
my @themes = ('prog', 'test');
31
my @themes = ('prog', 'test');
Lines 81-89 is(find_and_slurp($dir, 'prog', 'es-ES'), 'Theme prog, language es-ES', 'Found t Link Here
81
is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en',    'Fell back to test/en for test/fr-FR');
60
is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en',    'Fell back to test/en for test/fr-FR');
82
is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES');
61
is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES');
83
is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en',    'Fell back to prog/en for nope/fr-FR');
62
is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en',    'Fell back to prog/en for nope/fr-FR');
84
85
my $matching_string = q{<syspref name="singleBranchMode">0</syspref>};
86
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs();
87
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0');
88
89
1;
(-)a/t/db_dependent/XSLT.t (-1 / +23 lines)
Line 0 Link Here
0
- 
1
use Modern::Perl;
2
use Test::More tests => 2;
3
4
use t::lib::Mocks;
5
6
use C4::XSLT;
7
use Koha::Database;
8
use Koha::Libraries;
9
10
my $schema  = Koha::Database->new->schema;
11
$schema->storage->txn_begin;
12
13
# Test get_xslt_sysprefs
14
t::lib::Mocks::mock_preference( 'opacthemes', 'SomeThemeUnknown' );
15
my $cnt = Koha::Libraries->count;
16
my $matching_string = q{<syspref name="singleBranchMode">0</syspref>};
17
$matching_string =~ s/0/1/ if $cnt==1;
18
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs;
19
ok( $sysprefs_xml =~ m/$matching_string/, 'Check singleBranchMode');
20
ok( $sysprefs_xml =~ m/<syspref name="opacthemes">SomeThemeUnknown<\/syspref>/,
21
    'mocked preference found' );
22
23
$schema->storage->txn_rollback;

Return to bug 18445