1 package Catalyst::Test;
4 use UNIVERSAL::require;
6 $ENV{CATALYST_ENGINE} = 'Test';
10 Catalyst::Test - Test Catalyst applications
18 use Catalyst::Test 'TestApp';
19 request('index.html');
22 # Tests with inline apps need to use Catalyst::Engine::Test
25 use Catalyst qw[-Engine=Test];
29 my ( $self, $c ) = @_;
30 $c->res->output('bar');
36 use Test::More tests => 1;
37 use Catalyst::Test 'TestApp';
39 ok( get('/foo') =~ /bar/ );
44 Test Catalyst applications.
52 my $content = get('foo/bar?test=1');
56 Returns a C<HTTP::Response> object.
58 my $res =request('foo/bar?test=1');
64 if ( my $class = shift ) {
66 unless ( $INC{'Test/Builder.pm'} ) {
67 die qq/Couldn't load "$class", "$@"/ if $@;
71 my $caller = caller(0);
72 *{"$caller\::request"} = sub { $class->run(@_) };
73 *{"$caller\::get"} = sub { $class->run(@_)->content };
83 Sebastian Riedel, C<sri@cpan.org>
87 This program is free software, you can redistribute it and/or modify it under
88 the same terms as Perl itself.