Apache-Test
view release on metacpan or search on metacpan
lib/Apache/TestRequest.pm view on Meta::CPAN
my $times = 0;
my $found_same_interp = '';
do {
#loop until we get a response from our interpreter instance
$res = $sub->($url, @args);
die "no result" unless $res;
my $code = $res->code;
if ($code == 200) {
$found_same_interp = $res->header(INTERP_KEY) || '';
}
elsif ($code == 404) {
# try again
}
else {
die sprintf "failed to run the request (url=%s):\n" .
"code=%s, response:\n%s", $url, $code, $res->content;
}
unless ($found_same_interp eq $same_interp) {
$found_same_interp = '';
}
lib/Apache/TestUtil.pm view on Meta::CPAN
use Apache::Test;
use Apache::TestUtil;
use Apache::TestRequest qw(GET);
plan tests => 1;
t_client_log_error_is_expected();
my $url = "/error_document/cannot_be_found";
my $res = GET($url);
ok t_cmp(404, $res->code, "test 404");
After running this test the I<error_log> file will include an entry
similar to the following snippet:
*** The following error entry is expected and harmless ***
[Tue Apr 01 14:02:55 2003] [error] [client 127.0.0.1]
File does not exist: /tmp/test/t/htdocs/error
When more than one entry is expected, an optional numerical argument,
indicating how many entries to expect, can be passed. For example:
( run in 1.591 second using v1.01-cache-2.11-cpan-39bf76dae61 )