You are here

public function UrlIntegrationTest::testResetPager in Facets 8

Regression test for #2898189.

@link https://www.drupal.org/node/2898189

File

tests/src/Functional/UrlIntegrationTest.php, line 184

Class

UrlIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

public function testResetPager() {
  $id = 'owl';
  $name = 'Owl';
  $this
    ->createFacet($name, $id);

  // Set view pager option to 2 items, so we can check the pager rest on the
  // facet links.
  $view = Views::getView('search_api_test_view');
  $view
    ->setDisplay('page_1');
  $pagerOptions = $view->display_handler
    ->getOption('pager');
  $pagerOptions['options']['items_per_page'] = 2;
  $view->display_handler
    ->setOption('pager', $pagerOptions);
  $view
    ->save();
  $content_types = [
    'item',
    'article',
  ];
  foreach ($content_types as $content_type) {
    $this
      ->drupalGet('search-api-test-fulltext');
    $this
      ->clickLink('2');
    $this
      ->assertNotFalse(strpos($this
      ->getUrl(), 'page=1'));
    $this
      ->clickLink($content_type);
    $this
      ->assertFalse(strpos($this
      ->getUrl(), 'page=1'));
  }
}