function SandboxDirectoryValidatorTest::providerTestCheckNotInActive

Data provider for testCheckNotInActive().

Return value

mixed[] The test cases.

File

core/modules/package_manager/tests/src/Unit/SandboxDirectoryValidatorTest.php, line 59

Class

SandboxDirectoryValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\SandboxDirectoryValidator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public static function providerTestCheckNotInActive() : array {
  $expected_symlink_validation_error = ValidationResult::createError([
    t('The sandbox 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.