Lines 3-24
use Test::More tests => 2;
Link Here
|
3 |
|
3 |
|
4 |
use t::lib::Mocks; |
4 |
use t::lib::Mocks; |
5 |
use C4::XSLT; |
5 |
use C4::XSLT; |
|
|
6 |
use Koha::Caches; |
6 |
use Koha::Database; |
7 |
use Koha::Database; |
7 |
|
8 |
|
8 |
our $schema = Koha::Database->new->schema; |
9 |
our $schema = Koha::Database->new->schema; |
|
|
10 |
our $cache = Koha::Caches->get_instance; |
9 |
|
11 |
|
10 |
# Here we go |
12 |
# Here we go |
11 |
$schema->storage->txn_begin; |
13 |
$schema->storage->txn_begin; |
12 |
subtest 'CustomXSLTExportList: Check export options' => sub { |
14 |
subtest 'CustomXSLTExportList: Caching' => sub { |
13 |
plan tests => 2; |
15 |
plan tests => 1; |
14 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); |
16 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'custom'); |
15 |
my $list = C4::XSLT::CustomXSLTExportList(1); |
17 |
$cache->clear_from_cache('CustomXSLTExportListOPAC'); |
16 |
is( @$list>0, 1, 'We expect at least one result: simple export' ); |
18 |
my $list = C4::XSLT::CustomXSLTExportList(1); |
17 |
t::lib::Mocks::mock_preference('OpacExportOptions', 'dc'); |
19 |
push @$list, { nonsense => 1 }; |
|
|
20 |
$cache->set_in_cache( 'CustomXSLTExportListOPAC', $list ); |
21 |
my $n = @$list; |
18 |
$list = C4::XSLT::CustomXSLTExportList(1); |
22 |
$list = C4::XSLT::CustomXSLTExportList(1); |
19 |
is( @$list, 0, 'We expect an empty list now' ); |
23 |
is( @$list, $n, 'This list comes from the cache and that is fine' ); |
|
|
24 |
$cache->clear_from_cache('CustomXSLTExportListOPAC'); |
20 |
}; |
25 |
}; |
21 |
|
|
|
22 |
subtest 'buildKohaItemsNamespace status tests' => sub { |
26 |
subtest 'buildKohaItemsNamespace status tests' => sub { |
23 |
plan tests => 13; |
27 |
plan tests => 13; |
24 |
my $item = $builder->build_sample_item({}); |
28 |
my $item = $builder->build_sample_item({}); |
25 |
- |
|
|