function StageNotInActiveValidatorTest::providerTestCheckNotInActive

Data provider for testCheckNotInActive().

Return value

mixed[] The test cases.

File

core/modules/package_manager/tests/src/Unit/StageNotInActiveValidatorTest.php, line 58

Class

StageNotInActiveValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\StageNotInActiveValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public static function providerTestCheckNotInActive() : array {
    $expected_symlink_validation_error = ValidationResult::createError([
        t('Stage directory is a subdirectory of the active directory.'),
    ]);
    return [
        "Absolute paths which don't satisfy" => [
            [
                $expected_symlink_validation_error,
            ],
            "/var/root",
            "/var/root/xyz",
        ],
        "Absolute paths which satisfy" => [
            [],
            "/var/root",
            "/home/var/root",
        ],
        'Stage with .. segments, outside active' => [
            [],
            "/var/root/active",
            "/var/root/active/../stage",
        ],
        'Stage without .. segments, outside active' => [
            [],
            "/var/root/active",
            "/var/root/stage",
        ],
        'Stage with .. segments, inside active' => [
            [
                $expected_symlink_validation_error,
            ],
            "/var/root/active",
            "/var/root/active/../active/stage",
        ],
        'Stage without .. segments, inside active' => [
            [
                $expected_symlink_validation_error,
            ],
            "/var/root/active",
            "/var/root/active/stage",
        ],
        'Stage with .. segments, outside active, active with .. segments' => [
            [],
            "/var/root/active",
            "/var/root/active/../stage",
        ],
        'Stage without .. segments, outside active, active with .. segments' => [
            [],
            "/var/root/random/../active",
            "/var/root/stage",
        ],
        'Stage with .. segments, inside active, active with .. segments' => [
            [
                $expected_symlink_validation_error,
            ],
            "/var/root/random/../active",
            "/var/root/active/../active/stage",
        ],
        'Stage without .. segments, inside active, active with .. segments' => [
            [
                $expected_symlink_validation_error,
            ],
            "/var/root/random/../active",
            "/var/root/active/stage",
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.