@@ -, +, @@
# Failed test 'This list comes from the cache and that is fine'
# at t/db_dependent/XSLT.t line 122.
# got: '1'
# expected: '2'
# Looks like you failed 1 test of 1.
# Failed test 'CustomXSLTExportList: Caching'
# at t/db_dependent/XSLT.t line 124.
# Looks like you failed 1 test of 3.
-------------------
Failed test: 2
Non-zero exit status: 1
---
t/XSLT.t | 39 +++++++++++++++++++++++++++++++++++----
t/db_dependent/XSLT.t | 19 +++++++++++++++++++
2 files changed, 54 insertions(+), 4 deletions(-)
--- a/t/XSLT.t
+++ a/t/XSLT.t
@@ -21,13 +21,13 @@ use Test::More;
use File::Temp;
use File::Path qw/make_path/;
-use t::lib::Mocks;
+use t::lib::Mocks qw( mock_preference );
use Module::Load::Conditional qw/check_install/;
BEGIN {
if ( check_install( module => 'Test::DBIx::Class' ) ) {
- plan tests => 9;
+ plan tests => 12;
} else {
plan skip_all => "Need Test::DBIx::Class"
}
@@ -73,6 +73,37 @@ is(find_and_slurp($dir, 'test', 'fr-FR'), 'Theme test, language en', 'Fell ba
is(find_and_slurp($dir, 'nope', 'es-ES'), 'Theme prog, language es-ES', 'Fell back to prog/es-ES for nope/es-ES');
is(find_and_slurp($dir, 'nope', 'fr-FR'), 'Theme prog, language en', 'Fell back to prog/en for nope/fr-FR');
-my $matching_string = q{0};
+my $matching_string = q{[0|1]};
my $sysprefs_xml = C4::XSLT::get_xslt_sysprefs();
-ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has a value of 0');
+ok( $sysprefs_xml =~ m/$matching_string/, 'singleBranchMode has no value');
+
+t::lib::Mocks::mock_config('opachtdocs', "$dir");
+make_path("$dir/bootstrap/en/xslt/biblioexport");
+
+# Make XSL with title
+open my $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_01.xsl";
+print $fh qq|
+
+|;
+close $fh;
+
+# Make XSL without title
+open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_02.xsl";
+print $fh qq|
+
+|;
+close $fh;
+
+open $fh, '>', "$dir/bootstrap/en/xslt/biblioexport/export_03.xsl";
+print $fh qq||;
+close $fh;
+
+my @custom_xslts = @{C4::XSLT::CustomXSLTExportList(1)};
+ok((scalar @custom_xslts) == 2, "CustomXSLTExportList finds custom XSLTs");
+ok($custom_xslts[0]->{filename} eq "Export 01", "Title is specified in root node");
+ok($custom_xslts[1]->{filename} eq "export_02", "Title is filename if not specified");
--- a/t/db_dependent/XSLT.t
+++ a/t/db_dependent/XSLT.t
@@ -1,3 +1,20 @@
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see .
+
use Modern::Perl;
use MARC::Record;
@@ -16,6 +33,8 @@ BEGIN {
}
our $schema = Koha::Database->new->schema;
+my $builder = t::lib::TestBuilder->new;
+our $cache = Koha::Caches->get_instance;
# Here we go
$schema->storage->txn_begin;
--