function SymlinkValidatorTest::testSymlinksWithinSamePackage

Tests that relative symlinks within the same package are supported.

File

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

Class

SymlinkValidatorTest
@covers \Drupal\package_manager\Validator\SymlinkValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testSymlinksWithinSamePackage() : void {
    $project_root = $this->container
        ->get(PathLocator::class)
        ->getProjectRoot();
    $drush_dir = $project_root . '/vendor/drush/drush';
    mkdir($drush_dir . '/docs', 0777, TRUE);
    touch($drush_dir . '/drush_logo-black.png');
    // Relative symlinks must be made from their actual directory to be
    // correctly evaluated.
    chdir($drush_dir . '/docs');
    symlink('../drush_logo-black.png', 'drush_logo-black.png');
    // 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.