function TestExecutableFinder::find

Same name and namespace in other branches
  1. 11.x core/modules/package_manager/tests/modules/package_manager_test_validation/src/TestExecutableFinder.php \Drupal\package_manager_test_validation\TestExecutableFinder::find()

File

core/modules/package_manager/tests/modules/package_manager_test_validation/src/TestExecutableFinder.php, line 35

Class

TestExecutableFinder
A test-only executable finder that can be rigged to throw an exception.

Namespace

Drupal\package_manager_test_validation

Code

public function find(string $name) : string {
  if ($this->state
    ->get("throw for {$name}")) {
    $message = new TranslatableStringAdapter("{$name} is not a thing");
    throw new LogicException($message);
  }
  return $this->decorated
    ->find($name);
}

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