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');
26 perl -MCatalyst::Test=MyApp -e1 index.html
30 Test Catalyst applications.
38 my $content = get('foo/bar?test=1');
42 Returns a C<HTTP::Response> object.
44 my $res =request('foo/bar?test=1');
51 if ( ( caller(0) )[1] eq '-e' ) {
52 print request( $ARGV[0] || 'http://localhost' )->content;
59 if ( $class = shift ) {
61 unless ( $INC{'Test/Builder.pm'} ) {
62 die qq/Couldn't load "$class", "$@"/ if $@;
67 unless ( $class->engine->isa('Catalyst::Engine::Test') ) {
68 require Catalyst::Engine::Test;
69 splice( @{"$class\::ISA"}, @{"$class\::ISA"} - 1,
70 0, 'Catalyst::Engine::Test' );
73 my $caller = caller(0);
74 *{"$caller\::request"} = sub { $class->run(@_) };
75 *{"$caller\::get"} = sub { $class->run(@_)->content };
85 Sebastian Riedel, C<sri@cpan.org>
89 This program is free software, you can redistribute it and/or modify it under
90 the same terms as Perl itself.