You are here

public function IntegrationTest::testFramework in Facets 8

Same name in this branch
  1. 8 tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets\Functional\IntegrationTest::testFramework()
  2. 8 modules/facets_summary/tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets_summary\Functional\IntegrationTest::testFramework()

Tests the overall functionality of the Facets summary admin UI.

File

modules/facets_summary/tests/src/Functional/IntegrationTest.php, line 43

Class

IntegrationTest
Tests the overall functionality of the Facets summary admin UI.

Namespace

Drupal\Tests\facets_summary\Functional

Code

public function testFramework() {
  $this
    ->drupalGet('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextNotContains('Facets Summary');
  $values = [
    'name' => 'Owl',
    'id' => 'owl',
    'facet_source_id' => 'search_api:views_page__search_api_test_view__page_1',
  ];
  $this
    ->drupalPostForm('admin/config/search/facets/add-facet-summary', $values, 'Save');
  $this
    ->drupalPostForm(NULL, [], 'Save');
  $this
    ->drupalGet('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Facets Summary');
  $this
    ->assertSession()
    ->pageTextContains('Owl');
  $this
    ->drupalGet('admin/config/search/facets/facet-summary/owl/edit');
  $this
    ->assertSession()
    ->pageTextContains('No facets found.');
  $this
    ->createFacet('Llama', 'llama');
  $this
    ->drupalGet('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Llama');

  // Go back to the facet summary and check that the facets are not checked by
  // default and that they show up in the list here.
  $this
    ->drupalGet('admin/config/search/facets/facet-summary/owl/edit');
  $this
    ->assertSession()
    ->pageTextNotContains('No facets found.');
  $this
    ->assertSession()
    ->pageTextContains('Llama');
  $this
    ->assertSession()
    ->checkboxNotChecked('edit-facets-llama-checked');

  // Post the form and check that no facets are checked after saving the form.
  $this
    ->drupalPostForm(NULL, [], 'Save');
  $this
    ->assertSession()
    ->checkboxNotChecked('edit-facets-llama-checked');

  // Enable a facet and check it's status after saving.
  $this
    ->drupalPostForm(NULL, [
    'facets[llama][checked]' => TRUE,
  ], 'Save');
  $this
    ->assertSession()
    ->checkboxChecked('edit-facets-llama-checked');
  $this
    ->configureShowCountProcessor();
  $this
    ->configureResetFacetsProcessor();
}