@@ -, +, @@ folder --- C4/XSLT.pm | 2 ++ t/db_dependent/XSLT.t | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 t/db_dependent/XSLT.t --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -377,6 +377,8 @@ sub engine { sub CustomXSLTExportList { my $opac = shift; # opac (1) vs intranet (0) + return [] if $opac && C4::Context->preference('OpacExportOptions') !~ /custom/; + my @tabFiles; my $dir = C4::Context->config( $opac ? 'opachtdocs' : 'intrahtdocs') . --- a/t/db_dependent/XSLT.t +++ a/t/db_dependent/XSLT.t @@ -0,0 +1,23 @@ +use Modern::Perl; +use Test::More tests => 1; + +use t::lib::Mocks; +use C4::XSLT; +use Koha::Database; + +our $schema = Koha::Database->new->schema; + +# Here we go +$schema->storage->txn_begin; +subtest 'CustomXSLTExportList: Check export options' => sub { + plan tests => 2; + t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); + + my $list = C4::XSLT::CustomXSLTExportList(1); + is( @$list>0, 1, 'We expect at least one result: simple export' ); + + t::lib::Mocks::mock_preference('OpacExportOptions', 'dc'); + $list = C4::XSLT::CustomXSLTExportList(1); + is( @$list, 0, 'We expect an empty list now' ); +}; +$schema->storage->txn_rollback; --