|
Lines 6-32
use Test::Warn;
Link Here
|
| 6 |
use t::lib::TestBuilder; |
6 |
use t::lib::TestBuilder; |
| 7 |
use t::lib::Mocks; |
7 |
use t::lib::Mocks; |
| 8 |
|
8 |
|
|
|
9 |
use C4::XSLT; |
| 10 |
use Koha::Caches; |
| 9 |
use Koha::Database; |
11 |
use Koha::Database; |
| 10 |
use Koha::Libraries; |
12 |
use Koha::Libraries; |
| 11 |
use Koha::ItemTypes; |
13 |
use Koha::ItemTypes; |
| 12 |
use C4::XSLT; |
|
|
| 13 |
|
14 |
|
| 14 |
BEGIN { |
15 |
BEGIN { |
| 15 |
use_ok('C4::XSLT', qw( transformMARCXML4XSLT getAuthorisedValues4MARCSubfields buildKohaItemsNamespace )); |
16 |
use_ok('C4::XSLT', qw( transformMARCXML4XSLT getAuthorisedValues4MARCSubfields buildKohaItemsNamespace )); |
| 16 |
} |
17 |
} |
| 17 |
|
18 |
|
| 18 |
our $schema = Koha::Database->new->schema; |
19 |
our $schema = Koha::Database->new->schema; |
|
|
20 |
our $cache = Koha::Caches->get_instance; |
| 19 |
|
21 |
|
| 20 |
# Here we go |
22 |
# Here we go |
| 21 |
$schema->storage->txn_begin; |
23 |
$schema->storage->txn_begin; |
| 22 |
subtest 'CustomXSLTExportList: Check export options' => sub { |
24 |
subtest 'CustomXSLTExportList: Caching' => sub { |
| 23 |
plan tests => 2; |
25 |
plan tests => 1; |
| 24 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); |
26 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); |
| 25 |
my $list = C4::XSLT::CustomXSLTExportList(1); |
27 |
$cache->clear_from_cache('CustomXSLTExportListOPAC'); |
| 26 |
is( @$list>0, 1, 'We expect at least one result: simple export' ); |
28 |
my $list = C4::XSLT::CustomXSLTExportList(1); |
| 27 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'dc'); |
29 |
push @$list, { nonsense => 1 }; |
|
|
30 |
$cache->set_in_cache( 'CustomXSLTExportListOPAC', $list ); |
| 31 |
my $n = @$list; |
| 28 |
$list = C4::XSLT::CustomXSLTExportList(1); |
32 |
$list = C4::XSLT::CustomXSLTExportList(1); |
| 29 |
is( @$list, 0, 'We expect an empty list now' ); |
33 |
is( @$list, $n, 'This list comes from the cache and that is fine' ); |
|
|
34 |
$cache->clear_from_cache('CustomXSLTExportListOPAC'); |
| 30 |
}; |
35 |
}; |
| 31 |
|
36 |
|
| 32 |
subtest 'transformMARCXML4XSLT tests' => sub { |
37 |
subtest 'transformMARCXML4XSLT tests' => sub { |
| 33 |
- |
|
|