Kernel::Test::Role::Environment::ProvidesIdentifiers

NAME

Kernel::Test::Role::Environment::ProvidesIdentifiers – role to work with pseudo-random identifiers for tests.

GetRandomID()

creates a new pseudo random ID that can be used in tests as a unique identifier.

It is guaranteed that within a test this function will never return a duplicate.

Please note that these numbers are not really random and should only be used to create test data.

    my $RandomID1 = $Self->GetRandomID();
    my $RandomID2 = $Self->GetRandomID();

has 'RandomID'

lazily generates a RandomID for re-use in several places of a test case.

    my $RandomID = $Self->RandomID();   # Returns the same ID even if called multiple times from different places.

has 'UUID'

lazily generates a UUID for re-use in several places of a test case.

    my $UUID = $Self->UUID();   # Returns the same ID even if called multiple times from different places.

GetUUID()

shortcut method to generate a new UUID in a test.

    my $UUID = $Self->GetUUID();

GetRandomNumber()

creates a pseudo random number that can be used in tests as a unique identifier.

It is guaranteed that within a test this function will never return a duplicate.

Please note that these numbers are not really random and should only be used to create test data.

    my $RandomNumber = $Self->GetRandomNumber();

has 'RandomNumber'

lazily generates a RandomNumber for re-use in several places of a test case.

has 'SystemUserID'

provides a "full-permission" UserID for performing back end operations. This can be overridden by specifying a UnitTestSystemUserID configuration setting, in case the default UserID of 1 is not available.

    $Backend->APICall(
        ...
        UserID => $Self->SystemUserID(),
    );
Scroll to Top