function PathLocatorTest::providerWebRoot

Data provider for ::testWebRoot().

Return value

string[][] Sets of arguments to pass to the test method.

File

core/modules/package_manager/tests/src/Unit/PathLocatorTest.php, line 44

Class

PathLocatorTest
@coversDefaultClass \Drupal\package_manager\PathLocator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Unit

Code

public static function providerWebRoot() : array {
  // In certain sites (like those created by drupal/recommended-project), the
  // web root is a subdirectory of the project, and exists next to the
  // vendor directory.
  return [
    'recommended project' => [
      '/path/to/project/www',
      '/path/to/project',
      'www',
    ],
    'recommended project with trailing slash on app root' => [
      '/path/to/project/www/',
      '/path/to/project',
      'www',
    ],
    'recommended project with trailing slash on project root' => [
      '/path/to/project/www',
      '/path/to/project/',
      'www',
    ],
    'recommended project with trailing slashes' => [
      '/path/to/project/www/',
      '/path/to/project/',
      'www',
    ],
    // In legacy projects (i.e., created by drupal/legacy-project), the
    // web root is the project root.
'legacy project' => [
      '/path/to/drupal',
      '/path/to/drupal',
      '',
    ],
    'legacy project with trailing slash on app root' => [
      '/path/to/drupal/',
      '/path/to/drupal',
      '',
    ],
    'legacy project with trailing slash on project root' => [
      '/path/to/drupal',
      '/path/to/drupal/',
      '',
    ],
    'legacy project with trailing slashes' => [
      '/path/to/drupal/',
      '/path/to/drupal/',
      '',
    ],
  ];
}

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