You are here

public function HierarchicalTaxonomyMenuBasicTest::testEmptyBlock in Hierarchical Taxonomy Menu 8

Test the block with no content.

File

tests/src/FunctionalJavascript/HierarchicalTaxonomyMenuBasicTest.php, line 354

Class

HierarchicalTaxonomyMenuBasicTest
Tests the Hierarchical Taxonomy Menu basic config options.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\FunctionalJavascript

Code

public function testEmptyBlock() {
  $vocabulary = $this
    ->createVocabulary();
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $vocabulary
      ->id() . '|',
    'hide_block' => FALSE,
  ]);
  $this->block
    ->save();
  $this
    ->drupalGet('<front>');
  $this
    ->assertSession()
    ->pageTextContains('Hierarchical Taxonomy Menu');
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $vocabulary
      ->id() . '|',
    'hide_block' => TRUE,
  ]);
  $this->block
    ->save();

  // Empty block should be hidden if 'Hide block if the output is empty' is
  // checked.
  $this
    ->drupalGet('<front>');
  $this
    ->assertSession()
    ->pageTextNotContains('Hierarchical Taxonomy Menu');
}