You are here

protected function ProcessorIntegrationTest::checkSortByDisplay in Facets 8

Tests the display order.

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

File

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

Class

ProcessorIntegrationTest
Tests the processor functionality.

Namespace

Drupal\Tests\facets\Functional

Code

protected function checkSortByDisplay() {
  $this
    ->disableAllFacetSorts();
  $form = [
    'facet_sorting[display_value_widget_order][status]' => TRUE,
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertStringPosition('grape', 'strawberry');
  $this
    ->assertStringPosition('apple', 'banana');
  $form = [
    'facet_sorting[display_value_widget_order][status]' => TRUE,
    'facet_sorting[display_value_widget_order][settings][sort]' => 'DESC',
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertStringPosition('strawberry', 'grape');
  $this
    ->assertStringPosition('banana', 'apple');
  $form = [
    'facet_sorting[display_value_widget_order][status]' => FALSE,
  ];
  $this
    ->drupalPostForm($this->editForm, $form, 'Save');
}