Lines 21-33
use Test::More;
Link Here
|
21 |
use File::Temp; |
21 |
use File::Temp; |
22 |
use File::Path qw/make_path/; |
22 |
use File::Path qw/make_path/; |
23 |
|
23 |
|
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks qw( mock_preference ); |
25 |
|
25 |
|
26 |
use Module::Load::Conditional qw/check_install/; |
26 |
use Module::Load::Conditional qw/check_install/; |
27 |
|
27 |
|
28 |
BEGIN { |
28 |
BEGIN { |
29 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
29 |
if ( check_install( module => 'Test::DBIx::Class' ) ) { |
30 |
plan tests => 9; |
30 |
plan tests => 12; |
31 |
} else { |
31 |
} else { |
32 |
plan skip_all => "Need Test::DBIx::Class" |
32 |
plan skip_all => "Need Test::DBIx::Class" |
33 |
} |
33 |
} |
Lines 73-78
is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell ba
Link Here
|
73 |
is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES'); |
73 |
is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES'); |
74 |
is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR'); |
74 |
is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR'); |
75 |
|
75 |
|
76 |
my $matching_string = q{<syspref name="singleBranchMode">0</syspref>}; |
76 |
my $matching_string = q{<syspref name="singleBranchMode">[0|1]</syspref>}; |
77 |
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); |
77 |
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs(); |
78 |
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0'); |
78 |
ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value'); |
|
|
79 |
|
80 |
t::lib::Mocks::mock_config('opachtdocs', "$dir"); |
81 |
make_path("$dir/bootstrap/en/xslt/biblioexport"); |
82 |
|
83 |
# Make XSL with title |
84 |
open my $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_01.xsl"; |
85 |
print $fh qq|<?xml version="1.0" encoding="UTF-8"?> |
86 |
<xsl:stylesheet version="1.0" |
87 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
88 |
xmlns:marc="http://www.loc.gov/MARC21/slim" |
89 |
title="Export 01"> |
90 |
</xsl:stylesheet>|; |
91 |
close $fh; |
92 |
|
93 |
# Make XSL without title |
94 |
open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_02.xsl"; |
95 |
print $fh qq|<?xml version="1.0" encoding="UTF-8"?> |
96 |
<xsl:stylesheet version="1.0" |
97 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
98 |
xmlns:marc="http://www.loc.gov/MARC21/slim"> |
99 |
</xsl:stylesheet>|; |
100 |
close $fh; |
101 |
|
102 |
open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_03.xsl"; |
103 |
print $fh qq|<?xml version="1.0" encoding="UTF-8"?>|; |
104 |
close $fh; |
105 |
|
106 |
my @custom_xslts = @{C4::XSLT::CustomXSLTExportList(1)}; |
107 |
ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs"); |
108 |
ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node"); |
109 |
ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified"); |