public function AddURLKernelTest::testItemFieldExtraction in Search API 8
Tests extracting the field for a search item.
@covers ::addFieldValues
File
- tests/src/ Kernel/ Processor/ AddURLKernelTest.php, line 50 
Class
- AddURLKernelTest
- Tests the "Add URL" processor at a higher level.
Namespace
Drupal\Tests\search_api\Kernel\ProcessorCode
public function testItemFieldExtraction() {
  $node = $this->nodes[0];
  $id = Utility::createCombinedId('entity:node', $node
    ->id() . ':en');
  $item = \Drupal::getContainer()
    ->get('search_api.fields_helper')
    ->createItemFromObject($this->index, $node
    ->getTypedData(), $id);
  // Extract field values and check the value of the URL field.
  $fields = $item
    ->getFields();
  $expected = [
    $node
      ->toUrl('canonical')
      ->toString(),
  ];
  $this
    ->assertEquals($expected, $fields['url']
    ->getValues());
}