Test::Class::Moose::Role::CLI - Role for command line argument handling and extra CLI features
version 0.91
package My::CLI; use Moose; with 'Test::Class::Moose::Role::CLI'; sub _munge_class { return $_[1] =~ /^TestFor::/ ? $_[1] : 'TestFor::MyApp::' . $_[1] ); } sub _before_run { ... } sub _after_run { ... }
This role provides the core implementation of command line option processing for Test::Class::Moose::CLI. You can consume this role and add additional hooks to customize how your test classes are run.
See Test::Class::Moose::CLI for a list of all the available command line options that this role handles.
This role has several hook methods that it calls. The role provides no-op or default implementations of these hooks but you can provide an implementation in your class that does something.
This method is called for each class passed on the command line with the --classes option. It passed the command line argument (one per call). You can use this to allow people to pass short names like Model::Car and turn it into a full name like TestFor::MyApp::Model::Car.
--classes
Model::Car
TestFor::MyApp::Model::Car
By default this method is a no-op.
This method is called before the test classes are run (or even loaded).
This should return a list of directories containing test classes. The directories can be relative to the project root (t/lib) or absolute.
This defaults to returning a single path, t/lib.
This method will try to load all the classes passed on the command line if any were passed. If the value that was passed is a path rather than a class name, any leading part matching a value in the list from _test_lib_dirs will be stripped, and the rest will be transformed from a path to a module name.
_test_lib_dirs
Otherwise it invokes Test::Class::Moose::Load with the value returned by _test_lib_dirs as its argument.
This method is called after all the test classes are run.
Bugs may be submitted at https://github.com/houseabsolute/test-class-moose/issues.
I am also usually active on IRC as 'autarch' on irc://irc.perl.org.
irc://irc.perl.org
The source code repository for Test-Class-Moose can be found at https://github.com/houseabsolute/test-class-moose.
Curtis "Ovid" Poe <ovid@cpan.org>
Dave Rolsky <autarch@urth.org>
This software is copyright (c) 2012 - 2017 by Curtis "Ovid" Poe.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
The full text of the license can be found in the LICENSE file included with this distribution.
To install Test::Class::Moose, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Class::Moose
CPAN shell
perl -MCPAN -e shell install Test::Class::Moose
For more information on module installation, please visit the detailed CPAN module installation guide.