function RecipeFinderTest::testInvalidDirectoriesRejected

Tests that there is an error if the finder is given invalid directories.

Attributes

#[TestWith([ '', ])] #[TestWith([ 'nonsense', ])] #[TestWith([ [ 'core', 'nonsense', ], ])]

Parameters

string|array $directories: The directory, or directories, to instantiate the finder with.

File

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

Class

RecipeFinderTest
Tests the recipe finder.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testInvalidDirectoriesRejected(string|array $directories) : void {
  $error_directory = array_last((array) $directories);
  $this->expectException(DirectoryNotFoundException::class);
  $this->expectExceptionMessage("The \"{$error_directory}\" directory does not exist.");
  new Finder($directories);
}

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