You are here

protected function CoreViewsIntegrationTest::setOptionShowOnlyWhenFacetSourceVisible in Core Views Facets 8

Configures a facet to only be visible when accessing to the facet source.

Parameters

string $facet_name: The name of the facet.

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

File

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

Class

CoreViewsIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\core_views_facets\Functional

Code

protected function setOptionShowOnlyWhenFacetSourceVisible($facet_name) {
  $facet_id = $this
    ->convertNameToMachineName($facet_name);
  $facet_edit_page = Url::fromRoute('entity.facets_facet.edit_form', [
    'facets_facet' => $facet_id,
  ]);
  $this
    ->drupalGet($facet_edit_page);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $edit = [
    'facet_settings[only_visible_when_facet_source_is_visible]' => TRUE,
    'widget' => 'links',
    'widget_config[show_numbers]' => '0',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
}