1 package Catalyst::Engine::Test;
4 use base 'Catalyst::Engine::HTTP::Base';
8 Catalyst::Engine::Test - Catalyst Test Engine
12 A script using the Catalyst::Engine::Test module might look like:
17 $ENV{CATALYST_ENGINE} = 'Test';
21 use lib '/path/to/MyApp/lib';
24 MyApp->run('/a/path');
28 This is the Catalyst engine specialized for testing.
30 =head1 OVERLOADED METHODS
32 This class overloads some methods from C<Catalyst::Engine::HTTP::Base>.
42 my $request = shift || '/';
44 unless ( ref $request ) {
47 ( $request =~ m/http/i )
49 : URI->new( 'http://localhost' . $request );
51 $request = $uri->canonical;
54 unless ( ref $request eq 'HTTP::Request' ) {
55 $request = HTTP::Request->new( 'GET', $request );
58 my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port );
59 $request->header( 'Host' => $host );
61 my $http = Catalyst::Engine::Test::HTTP->new(
62 address => '127.0.0.1',
63 hostname => 'localhost',
65 response => HTTP::Response->new
68 $http->response->date(time);
70 $class->handler($http);
72 return $http->response;
83 Sebastian Riedel, C<sri@cpan.org>
84 Christian Hansen, C<ch@ngmedia.com>
88 This program is free software, you can redistribute it and/or modify it under
89 the same terms as Perl itself.