NAME
Statocles::Test - Common test routines for Statocles
VERSION
version 0.066
DESCRIPTION
This module provides some common test routines for Statocles tests.
SUBROUTINES
build_test_site
my $site = build_test_site( %site_args )
Build a site for testing. The build and deploy will be set correctly to temporary directories. %site_args will be given to the Statocles::Site constructor.
You must provide a theme (probably using the one in t/share/theme).
build_test_site_apps
my ( $site, $build_dir, $deploy_dir ) = build_test_site_apps( $share_dir, %site_args );
Build a site for testing, with some apps. Returns the site, the build dir, and the deploy dir.
test_constructor
test_constructor( $class, %args )
Test an object constructor. class is the class to test. args is a list of name/value pairs with the following keys:
- required
-
A set of name/value pairs for required arguments. These will be tested to ensure they are required. They will be added to every attempt to construct an object.
- default
-
A set of name/value pairs for default arguments. These will be tested to ensure they are set to the correct defaults.
test_pages
test_pages( $site, $app, %tests )
Test the pages of the given app. tests is a set of pairs of path => callback to test the pages returned by the app.
The callback will be given two arguments:
output-
The output of the rendered page.
dom-
If the page is HTML, a Mojo::DOM object ready for testing.
build_temp_site
my ( $tmpdir, $config_fn, $config ) = build_temp_site( $share_dir );
Build a config file so we can test config loading and still use temporary directories
AUTHOR
Doug Bell <preaction@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Doug Bell.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.