function RecipeFinderTest::testScanSpecificDirectories

Tests scanning specific directories for recipes.

File

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

Class

RecipeFinderTest
Tests the recipe finder.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testScanSpecificDirectories() : void {
  // The finder can scan a single directory...
  $finder = new Finder($this->root . '/core/recipes', TRUE);
  $names = array_column(iterator_to_array($finder), 'name');
  $this->assertContains('Administrator role', $names);
  $this->assertContains('Editorial workflow', $names);
  $this->assertNotContains('Input Test', $names);
  // ...or several.
  $finder = new Finder([
    $this->root . '/core/recipes',
    $this->root . '/core/tests/fixtures/recipes',
  ], TRUE);
  $names = array_column(iterator_to_array($finder), 'name');
  $this->assertContains('Administrator role', $names);
  $this->assertContains('Editorial workflow', $names);
  $this->assertContains('Input Test', $names);
}

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