You are here

protected function ProcessorIntegrationTest::checkExcludeItems in Facets 8

Tests the exclude items.

1 call to ProcessorIntegrationTest::checkExcludeItems()
ProcessorIntegrationTest::testProcessorIntegration in tests/src/Functional/ProcessorIntegrationTest.php
Tests the for processors in the frontend with a 'keywords' facet.

File

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

Class

ProcessorIntegrationTest
Tests the processor functionality.

Namespace

Drupal\Tests\facets\Functional

Code

protected function checkExcludeItems() {
  $form = [
    'facet_settings[exclude_specified_items][status]' => TRUE,
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
  $form = [
    'facet_settings[exclude_specified_items][status]' => TRUE,
    'facet_settings[exclude_specified_items][settings][exclude]' => 'banana',
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertSession()
    ->pageTextContains('Displaying 10 search results');
  $this
    ->assertSession()
    ->pageTextContains('grape');
  $this
    ->assertSession()
    ->pageTextNotContains('banana');
  $form = [
    'facet_settings[exclude_specified_items][status]' => TRUE,
    'facet_settings[exclude_specified_items][settings][exclude]' => '(.*)berry',
    'facet_settings[exclude_specified_items][settings][regex]' => TRUE,
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertSession()
    ->pageTextContains('Displaying 10 search results');
  $this
    ->assertSession()
    ->pageTextNotContains('strawberry');
  $this
    ->assertSession()
    ->pageTextContains('grape');
  $form = [
    'facet_settings[exclude_specified_items][status]' => FALSE,
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
}