View | Details | Raw Unified | Return to bug 12800
Collapse All | Expand All

(-)a/t/Cache.t (-5 / +24 lines)
Lines 1-9 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
# Tests Koha::Cache and whichever type of cache is enabled (through Koha::Cache)
3
# This file is part of Koha.
4
4
#
5
use strict;
5
# Koha is free software; you can redistribute it and/or modify it
6
use warnings;
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
7
19
8
use Test::More tests => 32;
20
use Test::More tests => 32;
9
21
Lines 16-21 BEGIN { Link Here
16
}
28
}
17
29
18
SKIP: {
30
SKIP: {
31
    # Set a special namespace for testing, to avoid breaking
32
    # if test is run with a different user than Apache's.
33
    $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests';
19
    my $cache = Koha::Cache->get_instance();
34
    my $cache = Koha::Cache->get_instance();
20
35
21
    skip "Cache not enabled", 28
36
    skip "Cache not enabled", 28
Lines 151-159 SKIP: { Link Here
151
166
152
END {
167
END {
153
  SKIP: {
168
  SKIP: {
169
        $ENV{ MEMCACHED_NAMESPACE } = 'unit_tests';
154
        my $cache = Koha::Cache->get_instance();
170
        my $cache = Koha::Cache->get_instance();
155
        skip "Cache not enabled", 1
171
        skip "Cache not enabled", 1
156
          unless ( $cache->is_cache_active() );
172
          unless ( $cache->is_cache_active() );
157
        is( $destructorcount, 1, 'Destructor run exactly once' );
173
        is( $destructorcount, 1, 'Destructor run exactly once' );
174
        # cleanup temporary file
175
        my $tmp_file = $cache->{ fastmmap_cache }->{ share_file };
176
        unlink $tmp_file if defined $tmp_file;
177
158
    }
178
    }
159
}
179
}
160
- 

Return to bug 12800