NAME

CookieTest - Cookie Testing Class

SYNOPSIS

In the Apache test conf:

PerlModule Cookie::Jar
PerlOptions +GlobalRequest
PerlSetupEnv On
<Directory "@documentroot@">
    SetHandler modperl
    PerlResponseHandler CookieTest
    AcceptPathInfo On
</Directory>

In the test unit:

use Apache::Test;
use Apache::TestRequest;
use HTTP::Request;

my $config = Apache::Test::config();
my $hostport = Apache::TestRequest::hostport( $config ) || '';
my $jar = Cookie::Jar->new( debug => $DEBUG );
my $ua = Apache::TestRequest->new;
my $req = HTTP::Request->new( GET => "http://${hostport}/tests/test01" );
$req->header( Host => $hostport );
my $resp = $ua->request( $req );
ok( $resp->content, 'ok' );

VERSION

v0.1.0

DESCRIPTION

This is a package for testing the Cookie module under Apache2/modperl2

METHODS

handler

The main handler method called by modperl.

It calls the right method based on the last fragment of the path. For example an http request to /test/test02 would call the method test02

It returns the value returned by the method called, which should be an Apache constant.

failure

Calls "reply" with Apache2::Const::HTTP_EXPECTATION_FAILED and failed and returns its value, which is the http code.

is

Provided with a resulting value and an expected value and this returns ok if both match, or a string explaining the failure to match.

ok

Provided with a boolean value, and this returns the value returned by "success" or "failure" otherwise.

reply

Provided with a response http code and some text data, and this will return the response to the http client.

success

Calls "reply" with Apache2::Const::HTTP_OK and ok and returns its value, which is the http code.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Cookie::Jar, Cookie

COPYRIGHT & LICENSE

Copyright (c) 2019-2021 DEGUEST Pte. Ltd.

You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.