You are here

protected function ProcessorIntegrationTest::checkSortByActive in Facets 8

Tests the active widget order.

1 call to ProcessorIntegrationTest::checkSortByActive()
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 568

Class

ProcessorIntegrationTest
Tests the processor functionality.

Namespace

Drupal\Tests\facets\Functional

Code

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