public function NameAutocompleteTest::testAutocompleteControllerWithInvalidBundle in Name Field 8
Tests the controller with an invalid bundle.
In this case it expected that an exception of type AccessDeniedHttpException is thrown.
File
- tests/
src/ Kernel/ NameAutocompleteTest.php, line 77
Class
- NameAutocompleteTest
- Tests name autocomplete.
Namespace
Drupal\Tests\name\KernelCode
public function testAutocompleteControllerWithInvalidBundle() {
$autocomplete = NameAutocompleteController::create($this->container);
$request = new Request();
$request->attributes
->add([
'q' => 'Bob',
]);
$this
->expectException(AccessDeniedHttpException::class);
$autocomplete
->autocomplete($request, 'field_name_test', 'entity_test', 'invalid_bundle', 'family');
}