RT 4.4.6 Documentation

RT::Test

Go to latest version →

NAME

RT::Test - RT Testing

NOTES

COVERAGE

To run the rt test suite with coverage support, install Devel::Cover and run:

    make test RT_DBA_USER=.. RT_DBA_PASSWORD=.. HARNESS_PERL_SWITCHES=-MDevel::Cover
    cover -ignore_re '^var/mason_data/' -ignore_re '^t/'

The coverage tests have DevelMode turned off, and have named_component_subs enabled for HTML::Mason to avoid an optimizer problem in Perl that hides the top-level optree from Devel::Cover.

UTILITIES

load_or_create_user

load_or_create_queue

load_or_create_custom_field

switch_templates_to TYPE

This runs /opt/rt4/etc/upgrade/switch-templates-to in order to change the templates from HTML to text or vice versa. TYPE is the type to switch to, either html or text.

switch_templates_ok TYPE

Calls switch_template_to and tests the return values.

object_scrips_are

Takes an RT::Scrip object or ID as the first argument and an arrayref of RT::Queue objects and/or Queue IDs as the second argument.

The scrip's applications (RT::ObjectScrip records) are tested to ensure they exactly match the arrayref.

An optional third arrayref may be passed to enumerate and test the queues the scrip is not added to. This is most useful for testing the API returns the correct results.

get_relocatable_dir

Takes a path relative to the location of the test file that is being run and returns a path that takes the invocation path into account.

e.g. RT::Test::get_relocatable_dir(File::Spec-updir(), 'data', 'emails')>

Parent directory traversals (.. or File::Spec->updir()) are naively canonicalized based on the test file path ($0) so that symlinks aren't followed. This is the exact opposite behaviour of most filesystems and is considered "wrong", however it is necessary for some subsets of tests which are symlinked into the testing tree.

get_relocatable_file

Same as get_relocatable_dir, but takes a file and a path instead of just a path.

e.g. RT::Test::get_relocatable_file('test-email', (File::Spec->updir(), 'data', 'emails'))

← Back to index