Permalink
Browse files

Item14061: Need to clear cache before each test.

  • Loading branch information...
1 parent e11b033 commit 4b263c399410954511ff0ae92f56d0da9c90d5ab @gac410 gac410 committed May 2, 2016
Showing with 33 additions and 0 deletions.
  1. +33 −0 UnitTestContrib/test/unit/CacheTests.pm
@@ -208,9 +208,40 @@ sub tear_down {
unlink("$Foswiki::cfg{WorkingDir}/${$}_generic.db");
}
+sub clearCache {
+ my $this = shift;
+
+ my $query = Unit::Request->new( { skin => ['none'], refresh => 'all', } );
+ $query->path_info("/System/WebHome");
+ $query->method('GET');
+
+ $this->createNewFoswikiSession( $Foswiki::cfg{AdminUserLogin},
+ $query, { view => 1 } );
+
+ my ( $resp, $result, $stdout, $stderr ) = $this->capture(
+ sub {
+ try {
+ no strict 'refs';
+ &{$UI_FN}( $this->{session} );
+ use strict 'refs';
+ $Foswiki::engine->finalize( $this->{session}{response},
+ $this->{session}{request} );
+ }
+ catch Foswiki::OopsException with {
+ my $e = shift;
+ $this->assert( 0, "Incorrect exception: " . $e->stringify() );
+ };
+
+ }
+ );
+
+}
+
sub check {
my ( $this, $pathinfo ) = @_;
+ $this->clearCache();
+
$UI_FN ||= $this->getUIFn( $this->{uifn} );
$Foswiki::cfg{Cache}{Debug} = 1;
my $query = Unit::Request->new( { skin => ['none'], } );
@@ -306,6 +337,8 @@ sub check_refresh {
my $pathinfo = shift;
my $refresh = shift;
+ $this->clearCache();
+
my $user =
( $refresh eq 'all' )
? $Foswiki::cfg{AdminUserLogin}

0 comments on commit 4b263c3

Please sign in to comment.