public function SitemapTaxonomyTest::testDeletedVocabulary in Sitemap 8
Ensure that deleted vocabularies do not trigger a fatal error if their ids still exist in config.
@TODO add a hook_vocabulary_alter if that is a thing?
File
- src/
Tests/ SitemapTaxonomyTest.php, line 67
Class
- SitemapTaxonomyTest
- Tests the display of taxonomies based on sitemap settings.
Namespace
Drupal\sitemap\TestsCode
public function testDeletedVocabulary() {
// Create the vocabulary to delete.
$this->vocabularyToDelete = $this
->createVocabulary();
// Configure the sitemap to display both vocabularies.
$vid = $this->vocabulary
->id();
$vid_to_delete = $this->vocabularyToDelete
->id();
$edit = [
"show_vocabularies[{$vid}]" => $vid,
"show_vocabularies[{$vid_to_delete}]" => $vid_to_delete,
];
$this
->drupalPostForm('admin/config/search/sitemap', $edit, t('Save configuration'));
// Delete the vocabulary.
$this->vocabularyToDelete
->delete();
// Visit /sitemap.
$this
->drupalGet('/sitemap');
}