function VocabularyUiTest::testTaxonomyAdminNoVocabularies

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php \Drupal\Tests\taxonomy\Functional\VocabularyUiTest::testTaxonomyAdminNoVocabularies()
  2. 8.9.x core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php \Drupal\Tests\taxonomy\Functional\VocabularyUiTest::testTaxonomyAdminNoVocabularies()
  3. 10 core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php \Drupal\Tests\taxonomy\Functional\VocabularyUiTest::testTaxonomyAdminNoVocabularies()

Tests the vocabulary overview with no vocabularies.

File

core/modules/taxonomy/tests/src/Functional/VocabularyUiTest.php, line 144

Class

VocabularyUiTest
Tests the taxonomy vocabulary interface.

Namespace

Drupal\Tests\taxonomy\Functional

Code

public function testTaxonomyAdminNoVocabularies() : void {
    // Delete all vocabularies.
    $vocabularies = Vocabulary::loadMultiple();
    foreach ($vocabularies as $key => $vocabulary) {
        $vocabulary->delete();
    }
    // Confirm that no vocabularies are found in the database.
    $this->assertEmpty(Vocabulary::loadMultiple(), 'No vocabularies found.');
    $this->drupalGet('admin/structure/taxonomy');
    // Check the default message for no vocabularies.
    $this->assertSession()
        ->pageTextContains('No vocabularies available.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.