NAME

Kwiki::Test - A helper module for testing Kwiki Plugins

SYNOPSIS

use strict;
use warnings;

use IO::All;
use Kwiki::Test;
use Test::More tests => 6;

my $REGISTRY_FILE = 'registry.dd';
my $CONFIG_FILE = 'config.yaml';
my $CONFIG_DIR = 'config';
my $TEMPLATE_DIR = 'template';
my $CSS_DIR = 'css';
my $HOME_PAGE = 'database/HomePage';

my $kwiki = Kwiki::Test->new->init;

ok($kwiki->exists_as_file($REGISTRY_FILE), "$REGISTRY_FILE exists");
ok($kwiki->exists_as_file($CONFIG_FILE), "$CONFIG_FILE exists");
ok($kwiki->exists_as_dir($TEMPLATE_DIR), "$TEMPLATE_DIR exists");
ok($kwiki->exists_as_dir($CONFIG_DIR), "$CONFIG_DIR exists");
ok($kwiki->exists_as_dir($CSS_DIR), "$CSS_DIR exists");
ok($kwiki->exists_as_file($HOME_PAGE), "$HOME_PAGE exists");

$kwiki->cleanup;

DESCRIPTION

Because of the way templates and other files are handled in kwiki it can often be a bit painful to write useful tests for Kwiki plugins. Kwiki::Test creates a kwiki installation in your modules build directory against which tests can be run.

The tests included in the distribution are the best examples of how to use the system.

Of special note: if you pass a reference to a list containing plugin modules to init() those modules will be added to the kwiki test configuration.

cleanup() removes the mess you've made. This may be moved into DESTROY in the future.

CREDITS

Kwiki::Test is based on some ideas from Dave Rolsky (co-worker at Socialtext). Thanks, Dave, for being an uptight bastard. And thanks to Brian for giving something worth being uptight about.

SEE ALSO

Kwiki

AUTHOR

Chris Dent <cdent@burningchrome.com>

COPYRIGHT

Copyright (c) 2005. Chris Dent. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as perl itself.

See http://www.perl.com/perl/misc/Artistic.html