Skip to content

Commit

Permalink
Item12925: Restore the CacheTests for 1.2
Browse files Browse the repository at this point in the history
They pass, but not sure how complete they are for the new cache code.
  • Loading branch information
gac410 committed Dec 18, 2014
1 parent 7e3eaf2 commit f6a50da
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions UnitTestContrib/test/unit/CacheTests.pm
Expand Up @@ -19,7 +19,11 @@ sub fixture_groups {
my @page;

foreach my $dir (@INC) {
if ( opendir( my $D, File::Spec->catdir( $dir, 'Foswiki', 'Cache' ) ) )
if (
opendir(
my $D, File::Spec->catdir( $dir, 'Foswiki', 'PageCache' )
)
)
{
foreach my $alg ( readdir $D ) {
next unless $alg =~ s/^(.*)\.pm$/$1/;
Expand All @@ -28,18 +32,19 @@ sub fixture_groups {
local $ENV{PATH} = $1;
($alg) = $alg =~ /^(.*)$/ms;

if ( eval "require Foswiki::Cache::$alg; 1;" ) {
if ( eval "require Foswiki::PageCache::$alg; 1;" ) {
no strict 'refs';
*{$alg} = sub {
my $this = shift;
$Foswiki::cfg{CacheManager} = 'Foswiki::Cache::' . $alg;
$Foswiki::cfg{CacheManager} =
'Foswiki::PageCache::' . $alg;
};
use strict 'refs';
push( @page, $alg );
}
else {
print STDERR
"Cannot test Foswiki::Cache::$alg\nCompilation error when trying to 'require' it\n";
"Cannot test Foswiki::PageCache::$alg\nCompilation error when trying to 'require' it\n $@";
}
}
closedir($D);
Expand All @@ -51,13 +56,13 @@ sub fixture_groups {
}

sub DBFileMeta {
$Foswiki::cfg{MetaCacheManager} = 'Foswiki::Cache::DB_File';
$Foswiki::cfg{MetaCacheManager} = 'Foswiki::PageCache::DB_File';

return;
}

sub BDBMeta {
$Foswiki::cfg{MetaCacheManager} = 'Foswiki::Cache::BDB';
$Foswiki::cfg{MetaCacheManager} = 'Foswiki::PageCache::BDB';

return;
}
Expand Down

0 comments on commit f6a50da

Please sign in to comment.