You are here

public function NameAutocompleteTest::testAutocompleteController in Name Field 8

Tests the controller.

File

tests/src/Kernel/NameAutocompleteTest.php, line 62

Class

NameAutocompleteTest
Tests name autocomplete.

Namespace

Drupal\Tests\name\Kernel

Code

public function testAutocompleteController() {
  $autocomplete = NameAutocompleteController::create($this->container);
  $request = new Request();
  $request->attributes
    ->add([
    'q' => 'Bob',
  ]);
  $result = $autocomplete
    ->autocomplete($request, 'field_name_test', 'entity_test', 'entity_test', 'family');
  $this
    ->assertInstanceOf(JsonResponse::class, $result);
}