You are here

public function FacetSourceTest::testEditUrlProcessor in Facets 8

Tests editing the url processor.

File

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

Class

FacetSourceTest
Tests the functionality of the facet source config entity.

Namespace

Drupal\Tests\facets\Functional

Code

public function testEditUrlProcessor() {

  // Change the url processor.
  $edit = [
    'url_processor' => 'dummy_query',
  ];
  $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 and that the url processor has the new value.
  $this
    ->assertSession()
    ->fieldExists('filter_key');
  $this
    ->assertSession()
    ->fieldExists('url_processor');

  /** @var \Behat\Mink\Element\NodeElement[] $elements */
  $elements = $this
    ->xpath('//input[@id=:id]', [
    ':id' => 'edit-url-processor-dummy-query',
  ]);
  $this
    ->assertEquals('dummy_query', $elements[0]
    ->getValue());
}