function TermKernelTest::testTermDelete
Same name in other branches
- 9 core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php \Drupal\Tests\taxonomy\Kernel\TermKernelTest::testTermDelete()
- 8.9.x core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php \Drupal\Tests\taxonomy\Kernel\TermKernelTest::testTermDelete()
- 11.x core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php \Drupal\Tests\taxonomy\Kernel\TermKernelTest::testTermDelete()
Tests that a deleted term is no longer in the vocabulary.
File
-
core/
modules/ taxonomy/ tests/ src/ Kernel/ TermKernelTest.php, line 40
Class
- TermKernelTest
- Kernel tests for taxonomy term functions.
Namespace
Drupal\Tests\taxonomy\KernelCode
public function testTermDelete() : void {
$vocabulary = $this->createVocabulary();
$valid_term = $this->createTerm($vocabulary);
// Delete a valid term.
$valid_term->delete();
$terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')
->loadByProperties([
'vid' => $vocabulary->id(),
]);
$this->assertEmpty($terms, 'Vocabulary is empty after deletion');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.