You are here

protected function CoreViewsIntegrationTest::setEmptyBehaviorFacetText in Core Views 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 CoreViewsIntegrationTest::setEmptyBehaviorFacetText()
CoreViewsIntegrationTest::testFramework in tests/src/Functional/CoreViewsIntegrationTest.php
Tests various operations via the Facets' admin UI.

File

tests/src/Functional/CoreViewsIntegrationTest.php, line 171

Class

CoreViewsIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\core_views_facets\Functional

Code

protected function setEmptyBehaviorFacetText($facet_name) {
  $facet_id = $this
    ->convertNameToMachineName($facet_name);
  $facet_display_page = Url::fromRoute('entity.facets_facet.edit_form', [
    'facets_facet' => $facet_id,
  ]);

  // 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');
}