You are here

public function FacetSourceTest::testEditFilterKey in Facets 8

Tests the facet source editing.

File

tests/src/Functional/FacetSourceTest.php, line 41

Class

FacetSourceTest
Tests the functionality of the facet source config entity.

Namespace

Drupal\Tests\facets\Functional

Code

public function testEditFilterKey() {

  // Change the filter key.
  $edit = [
    'filter_key' => 'fq',
  ];
  $this
    ->assertSession()
    ->fieldExists('filter_key');
  $this
    ->assertSession()
    ->fieldExists('url_processor');
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->addressEquals('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Facet source search_api:views_block__search_api_test_view__block_1 has been saved.');
  $this
    ->clickLink('Configure');

  // Test that saving worked filter_key has the new value.
  $this
    ->assertSession()
    ->fieldExists('filter_key');
  $this
    ->assertSession()
    ->fieldExists('url_processor');
  $this
    ->assertSession()
    ->responseContains('fq');
}