Name

CatalystX::Test::Most - Test base pulling in Catalyst::Test, Test::More, Test::Fatal, and HTTP::Request::Common for unit tests on Catalyst applications.

Synopsis

use CatalystX::Test::Most "MyApp";

subtest "Tests with plain Catalyst::Test" => sub {
    ok request("/")->is_success, "/ is okay";
    is exception { request("/no-such-uri") }, undef,
       "404s do not throw exceptions";
    is request("/no-such-uri")->code, 404, "And do return 404";
};

subtest "Tests with Test::WWW::Mechanize::Catalyst" => sub {
   my $mech = mech();
   $mech->get_ok("/", "GET /");
   $mech->content_contains("OHAI", "That's my app all right");
};

done_testing();

#    ok 1 - / is okay
#    ok 2 - 404s do not throw exceptions
#    ok 3 - And do return 404
#    1..3
# ok 2 - Tests with plain Catalyst::Test
#    ok 1 - GET /
#    ok 2 - My app all right
#    1..2
# ok 3 - Tests with Test::WWW::Mechanize::Catalyst

Exported Functions from Other Packages

Catalyst::Test

Everything, so see its documentation: Catalyst::Test. CatalystX::Test::Most is basically an overloaded version of it.

Test::More

All of its exported functions; see its documentation: Test::More.

Test::Fatal

See exception in Test::Fatal.

Test::WWW::Mechanize::Catalyst

You have easy access to a Test::WWW::Mechanize::Catalyst object. There are no related functions, just the object methods.

New Functions

  • ctx

    This is a wrapper to get the context object. It will only work on local tests (not remote servers).

  • mech

    Get a Test::WWW::Mechanize::Catalyst object. Unless specified, the app name and the arguments are recycled from the import of CatalystX::Test::Most.

Notes

strictures are exported.

Copyright and License

Ashley Pond V. Artistic License 2.0.