function RecipeFinderTest::testDiscoveryFollowsSymlinks

Tests that the recipe finder follows symlinks.

File

core/tests/Drupal/KernelTests/Core/Recipe/RecipeFinderTest.php, line 185

Class

RecipeFinderTest
Tests the recipe finder.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testDiscoveryFollowsSymlinks() : void {
  $cookbook_dir = FileSystem::getOsTemporaryDirectory();
  $link_name = uniqid($cookbook_dir . '/recipe_link');
  $target = $this->root . '/core/recipes/administrator_role';
  $file_system = new SymfonyFilesystem();
  $file_system->symlink($target, $link_name);
  $recipes = iterator_to_array(new Finder($cookbook_dir));
  $this->assertCount(1, $recipes);
  $this->assertSame('Administrator role', reset($recipes)->name);
  $file_system->remove($link_name);
}

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