NAME
t::request
VERSION
$LastChangedRevision: 426 $
SYNOPSIS
use t::request qw(is_xml);
my $str = t::request->new({
PATH_INFO => '/run/find',
REQUEST_METHOD => 'GET',
username => 'public',
cgi_params => {
q => q[dat],
...
},
});
is_xml($str, 'expected_data.html', 'test expected data');
DESCRIPTION
This module is a test harness for ClearPress-based applications which
roughly fakes an incoming HTTP request without needing any network
connectivity or web server. It works by setting various required
environment variables then calling into the application's request
handler.
t:request also exports some useful functions for helping with
tests. See below for functions matching "is_*".
SUBROUTINES/METHODS
new - a new harnessed application request
my $oRequest = t::request->new({
PATH_INFO => '/run/find', # URI to request
REQUEST_METHOD => 'GET', # GET POST PUT DELETE
username => 'public', # username to fake authentication
cgi_params => { # optional hashref of CGI parameters
},
});
is_xml - test XML string correlates to file
is_xml($sXML, $sFilename, $sTestDescription);
is_json - test JSON string correlates to file
is_xml($sJSON, $sFilename, $sTestDescription);
is_txt - test text string correlates to file
is_xml($sText, $sFilename, $sTestDescription);
is_xls - test XLS blob correlates to file
is_xml($sXLS, $sFilename, $sTestDescription);
DIAGNOSTICS
CONFIGURATION AND ENVIRONMENT
DEPENDENCIES
- base
- strict
- warnings
- Carp
- CGI
- Exporter
- English
- HTML::PullParser
- IO::Scalar
- JSON
- t::util
- ontrack::controller
- Readonly
- Test::More
- Spreadsheet::ParseExcel
INCOMPATIBILITIES
BUGS AND LIMITATIONS
AUTHOR
$Author: Roger Pettett$
LICENSE AND COPYRIGHT
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.