Kernel::Test::Role::IsTestCase::ConsoleCommand

NAME

Kernel::Test::Role::IsTestCase::ConsoleCommand – role for console command tests

PUBLIC INTERFACE

has 'CommandName'

holds the name of the console command to be tested, e. g. Maint::PostMaster::Read.

TestConsoleCommand()

runs the command and returns its exit code. You can pass in variable references to be used as STDIN/STDOUT/STDERR, if needed.

    my $ExitCode = $Self->TestConsoleCommand(
        Name           => 'Test Name',                  # optional, specify a better description of the test case.
        ConsoleCommand => 'Maint::PostMaster::Read',    # Optional, use if you test multiple commands in the same test.
        STDIN          => \'',                          # Optional
        STDOUT         => \$Output,                     # Optional
        STDERR         => \$Output,                     # Optional
        Arguments      => ['--no-ansi'],                # Optional
        ExpectedExitCode => 1,                          # Optional, specify if a non-0 exit code is expected.
    );
Scroll to Top