NAME
Daizu::Test - functions for use by the test suite
DESCRIPTION
The functions defined in here are only really useful for testing Daizu CMS. This stuff is used by the test suite, in particular t/00setup.t
which creates a test database and repository.
CONSTANTS
- $TEST_DBCONF_FILENAME
-
Name of configuration file which provides information about how to connect to the databases used for the test suite. The
test_config
function parses this.Value: test.conf
- $DB_SCHEMA_FILENAME
-
Name of the SQL file containing the database schema to load into the test database after creating it.
Value: db.sql
- $TEST_REPOS_DIR
-
Full path to the directory which should contain the testing repository created at the start of running the tests.
Value: .test-repos in the current directory
- $TEST_REPOS_URL
-
A 'file' URL to the test repository.
- $TEST_REPOS_DUMP
-
Full path to the Subversion dump file which is loaded into the test repository.
Value: test-repos.dump in the current directory.
- $TEST_DOCROOT_DIR
-
Full path to the directory into which output from publishing test content should be written.
Value: .test-docroot in the current directory
- $TEST_CONFIG
-
Filename of config file to use for testing.
Value: test-config.xml (which is created from test-config.xml.tmpl by t/00setup.t)
FUNCTIONS
The following functions are available for export from this module. None of them are exported by default.
- init_tests($num_tests, [$show_errors])
-
Load the test configuration file (which will allow you to use the test_config() function later), and check it to make sure the tests are properly configured. If they are then initialize Test::More with the number of tests expected (unless
$num_tests
is undef). Otherwise tell Test::More to skip all the tests.If
$show_errors
is present and true, display warnings about any problems with the test configuration file. This should be done in the first test program so that the user knows why the tests aren't being run. The others can just skip the tests. - test_config()
-
Return a reference to a hash of configuration values from the file specified by $TEST_DBCONF_FILENAME. This will fail if init_tests() hasn't been run yet.
- pg_template_dbh()
-
Returns a DBI database handle connected to the PostgreSQL
template1
database, which can be used for example to create the test database. - create_database()
-
Create the test database, load the database schema into it, and return a DBI handle for accessing it.
- drop_database()
-
Delete the test database. Sleeps for a second before doing so, to give the connections a chance to really get cleaned up.
- create_test_repos()
-
Create an empty Subversion repository for testing, in
$TEST_REPOS_DIR
.
COPYRIGHT
This software is copyright 2006 Geoff Richards <geoff@laxan.com>. For licensing information see this page: