Kernel::Test::Role::IsTestCase::DaemonModule

NAME

Kernel::Test::Role::IsTestCase::DaemonModule – Role for Daemon Module tests

ATTRIBUTES

has 'DaemonModule'

holds the name of the Daemon Module to be tested, e. g. SchedulerTaskWorker::Cron.

TestDaemonModule()

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

    my $Result = $Self->TestDaemonModule(
        Name           => 'Test Name',                  # optional, specify a better description of the test case.
        DaemonModule   => 'SchedulerTaskWorker::Cron',  # Optional, use if you test multiple commands in the same test.
        STDIN          => \'',                          # Optional
        STDOUT         => \$Output,                     # Optional
        STDERR         => \$Output,                     # Optional
        Config      => {                                # Optional
            TaskID   => 123,
            TaskName => 'UnitTest',
            Data     => {
                Module   => 'Kernel::System::Console::Command::Maint::Ticket::Dump',
                Function => 'Execute',
                Params   => [ '--article-limit', '2', $TicketID ],
            },
        },
        ExpectedExitCode => 1,                          # Optional, specify if a non-0 exit code is expected.
    );
Scroll to Top