function SymlinkValidatorTest::testSymlinkToDirectory

Tests what happens when there is a symlink to a directory.

File

core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php, line 142

Class

SymlinkValidatorTest
@covers \Drupal\package_manager\Validator\SymlinkValidator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testSymlinkToDirectory() : void {
  $project_root = $this->container
    ->get(PathLocator::class)
    ->getProjectRoot();
  mkdir($project_root . '/modules/custom');
  // Relative symlinks must be made from their actual directory to be
  // correctly evaluated.
  chdir($project_root . '/modules/custom');
  symlink('../example', 'example_module');
  // Switch back to the Drupal root to ensure that the check isn't affected
  // by which directory we happen to be in.
  chdir($this->getDrupalRoot());
  $this->assertStatusCheckResults([]);
}

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