You are here

protected function IntegrationTest::setEmptyBehaviorFacetText in Facets 8

Configures empty behavior option to show a text on empty results.

Parameters

string $facet_name: The name of the facet.

1 call to IntegrationTest::setEmptyBehaviorFacetText()
IntegrationTest::testFramework in tests/src/Functional/IntegrationTest.php
Tests various operations via the Facets' admin UI.

File

tests/src/Functional/IntegrationTest.php, line 881

Class

IntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

protected function setEmptyBehaviorFacetText($facet_name) {
  $facet_id = $this
    ->convertNameToMachineName($facet_name);
  $facet_display_page = '/admin/config/search/facets/' . $facet_id . '/edit';

  // Go to the facet edit page and make sure "edit facet %facet" is present.
  $this
    ->drupalGet($facet_display_page);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Configure the text for empty results behavior.
  $edit = [
    'facet_settings[empty_behavior]' => 'text',
    'facet_settings[empty_behavior_container][empty_behavior_text][value]' => 'No results found for this block!',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
}