NAME

Test::Mock::Apache2 - Mock mod_perl2 objects when running outside of Apache

VERSION

version 0.01

SYNOPSIS

use Test::Mock::Apache2;

my $r = Apache2::RequestUtil->request();
my $apr_req = APR::Request::Apache2->handle($r);

...

DESCRIPTION

Allows to work with Apache2::* objects without a running modperl server.

The purpose of this class is to be able to run some minimal unit tests for a code base that's hopelessly entangled with the Apache internals.

Current state is, to say the least, very incomplete. Will be hopefully expanded as the unit test suite grows.

METHODS

ap2_request

Return a mock Apache2::RequestRec empty object.

ap2_request_ap2

Return a mock APR::Request::Apache2 empty object.

ap2_requestutil

Mocks the Apache2::RequestUtil> module to fake the +GlobalRequest option, so you can execute code like:

my $r = Apache2::RequestUtil->request();

and get back an Apache2::RequestRec object. Uses "ap2_request".

init_mocked_objects

Creates the initial instances of the mocked objects for the various Apache2::* classes.

AUTHOR

Cosimo Streppone <cosimo@opera.com>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Opera Software ASA.

This is free software, licensed under:

The (three-clause) BSD License