Kernel::Test::Role::IsTestCase::DBUpdateModule

NAME

Kernel::Test::Role::IsTestCase::DBUpdateModule – Role for DBUpdate module tests.

PUBLIC INTERFACE

has 'ModuleName'

Holds the name of the DBUpdate module be tested, e. g. MigrateAdminInterfaceAccessGroup or Permanent::SetSystemVersion.

TestDBUpdateModule()

Runs the DBUpdate module and returns its success state. You can pass additional parameters, if needed.

    my $Success = $Self->TestDBUpdateModule(
        ModuleName => 'MigrateAdminInterfaceAccessGroup',    # Optional, use if you test multiple modules in the same test.
        Method     => 'Run',                                 # Optional, use if you test multiple methods of one module
                                                             #   in the same test.
        Params     => {                                      # Optional
            UnitTest => 1,
        },
        Arguments  => {                                      # Optional, Values that are passed to the module method
            Argument => Value
        },
        ExpectedReturnValue => 1,                            # Optional, specify if a non-true return value is expected.

        ExpectedStdOut => [                                  # Optional, specify if a module should output something on
            'AdminInfo: ...',                                #   standard output; each item represents a line (or part)
        ],                                                   #   of the line

        ExpectedStdErr => [                                  # Optional, specify if a module should output something on
            'ERROR: ...',                                    #   standard error; each item represents a line (or part)
        ],                                                   #   of the line
    );

RunTestStep()

Run the defined test case in context of a DBUpdate module.

    my $Success = $Self->RunTestStep(
        ModuleName => 'MigrateAdminInterfaceAccessGroup',    # Optional, use if you test multiple modules in the same test.
        Params     => {                                      # Optional
            UnitTest => 1,
        },
        ExpectedReturnValue => 1,                            # Optional, specify if a non-true return value is expected.

        ExpectedStdOut => [                                  # Optional, specify if a module should output something on
            'AdminInfo: ...',                                #   standard output; each item represents a line (or part)
        ],                                                   #   of the line

        ExpectedStdErr => [                                  # Optional, specify if a module should output something on
            'ERROR: ...',                                    #   standard error; each item represents a line (or part)
        ],                                                   #   of the line

        ExpectedSettings => [                                # Optional, specify if a module is expected to modify
            {                                                #   certain SysConfig settings and the new state should be
                SettingName  => 'AdminInterfaceAccessGroup', #   checked; each item refers to a single setting and its
                SettingValue => [                            #   effective value
                    'admin',
                ],
            },
        ],

        ExpectedACLs => {                                    # Optional, specify if a module is expected to modify
            ACLName => {                                     #   certain ACL and the new state should be checked; each
                ConfigMatch  => {...},                       #   key will be deep inspected and compared with supplied
                ConfigChange => {...},                       #   value
            },
        ],
    );
Scroll to Top