You are here

public function DataFetcherAutocompleteTest::testAutocomplete in Typed Data API enhancements 8

Tests that basic autocompletion works.

@covers ::autocompletePropertyPath

File

tests/src/Kernel/DataFetcherAutocompleteTest.php, line 106

Class

DataFetcherAutocompleteTest
Tests that data fetcher autocomplete function works correctly.

Namespace

Drupal\Tests\typed_data\Kernel

Code

public function testAutocomplete() {
  $definitions = [
    'node' => $this->nodeDefinition,
  ];
  $results = $this->dataFetcher
    ->autocompletePropertyPath($definitions, 'n');
  $this
    ->assertSame([
    [
      'value' => 'node',
      'label' => 'node',
    ],
    [
      'value' => 'node.',
      'label' => 'node...',
    ],
  ], $results);
}