You are here

public function HierarchicalTaxonomyMenuBasicTest::testZeroDepth in Hierarchical Taxonomy Menu 8

Test zero depth.

File

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

Class

HierarchicalTaxonomyMenuBasicTest
Tests the Hierarchical Taxonomy Menu basic config options.

Namespace

Drupal\Tests\hierarchical_taxonomy_menu\FunctionalJavascript

Code

public function testZeroDepth() {
  $this->block
    ->set('settings', [
    'label' => 'Hierarchical Taxonomy Menu',
    'label_display' => 'visible',
    'vocabulary' => $this->vocabulary
      ->id() . '|',
    'max_depth' => 0,
  ]);
  $this->block
    ->save();
  $this
    ->drupalGet('<front>');

  // We should see just parents. All descendants must be hidden.
  for ($i = 1; $i < 4; $i++) {
    $this
      ->assertSession()
      ->pageTextContains('Parent term ' . $i);
    for ($n = 1; $n < 12; $n++) {
      $this
        ->assertSession()
        ->pageTextNotContains('Child term ' . $i . '-' . $n);
    }
  }
}