You are here

public function ProcessorIntegrationTest::checkRenderedItemIntegration in Search API 8

Tests the integration of the "Rendered item" processor.

1 call to ProcessorIntegrationTest::checkRenderedItemIntegration()
ProcessorIntegrationTest::testProcessorIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the admin UI for processors.

File

tests/src/Functional/ProcessorIntegrationTest.php, line 602

Class

ProcessorIntegrationTest
Tests the admin UI for processors.

Namespace

Drupal\Tests\search_api\Functional

Code

public function checkRenderedItemIntegration() {
  $index = $this
    ->loadIndex();
  $index
    ->removeProcessor('rendered_item');
  $index
    ->save();
  $this
    ->assertTrue($this
    ->loadIndex()
    ->isValidProcessor('rendered_item'), 'The "Rendered item" processor cannot be disabled.');
  $options['query']['datasource'] = '';
  $this
    ->drupalGet($this
    ->getIndexPath('fields/add/nojs'), $options);

  // See \Drupal\search_api\Tests\IntegrationTest::addField().
  $this
    ->assertSession()
    ->responseContains('name="rendered_item"');
  $this
    ->submitForm([], 'rendered_item');
  $args['%label'] = 'Rendered HTML output';
  $this
    ->assertSession()
    ->responseContains(new FormattableMarkup('Field %label was added to the index.', $args));
  $this
    ->assertSession()
    ->addressEquals($this
    ->getIndexPath('fields/edit/rendered_item'));
  $edit = [
    'roles[]' => [
      'authenticated',
    ],
    'view_mode[entity:node][article]' => 'default',
    'view_mode[entity:node][page]' => 'teaser',
  ];
  $this
    ->submitForm($edit, 'Save');
  $this
    ->assertSession()
    ->addressEquals($this
    ->getIndexPath('fields'));
  $this
    ->assertSession()
    ->responseContains('The field configuration was successfully saved.');
}