Apache-Precompress

 view release on metacpan or  search on metacpan

t/00-decompress.t  view on Meta::CPAN


$request->set_always('dir_config', $dir_conf);

$request->mock('send_http_header',
	sub
	{
		my $self = shift;
	}
);

$log_obj->mock('error',
	sub
	{
		my $self = shift;
		my $error = shift;
	}
);

$request->set_always('log', $log_obj);

$request->mock('print',
	sub
	{
		my $self = shift;
		$data = shift;
	}
);

$request->mock('content_encoding',
	sub
	{
		my $self = shift;
	}
);

$request->mock('header_in',
	sub
	{
		my $self = shift;
		my $name = shift;
		
		my $opts = {
			'Accept-Encoding'	=>	""
		};
		return	$opts->{$name};
	}
);

sub Apache::Constants::OK
{
	return 200;
}

sub Apache::Constants::SERVER_ERROR
{
	return 500;
}

sub Apache::Constants::NOT_FOUND
{
	return 404;
}

Apache::Precompress::handler($request);

# Compare the file to the data below
my $contents = "";

open (FH,'<',$dir . '/baseline.html');
{
	local $/ = undef;
	$contents = <FH>;
}
close FH;


ok($contents eq $data, "The decompressed content matches the baseline");



( run in 1.162 second using v1.01-cache-2.11-cpan-5a3173703d6 )