1 package Catalyst::Test;
4 use UNIVERSAL::require;
9 $ENV{CATALYST_ENGINE} = 'Test';
13 Catalyst::Test - Test Catalyst applications
21 use Catalyst::Test 'TestApp';
22 request('index.html');
25 # Tests with inline apps need to use Catalyst::Engine::Test
28 use Catalyst qw[-Engine=Test];
32 my ( $self, $c ) = @_;
33 $c->res->output('bar');
39 use Test::More tests => 1;
40 use Catalyst::Test 'TestApp';
42 ok( get('/foo') =~ /bar/ );
47 Test Catalyst applications.
55 my $content = get('foo/bar?test=1');
59 Returns a C<HTTP::Response> object.
61 my $res =request('foo/bar?test=1');
67 if ( $class = shift ) {
69 unless ( $INC{'Test/Builder.pm'} ) {
70 die qq/Couldn't load "$class", "$@"/ if $@;
74 my $caller = caller(0);
75 *{"$caller\::request"} = sub { $class->run(@_) };
76 *{"$caller\::get"} = sub { $class->run(@_)->content };
86 Sebastian Riedel, C<sri@cpan.org>
90 This program is free software, you can redistribute it and/or modify it under
91 the same terms as Perl itself.