public function TermKernelTest::testTermDelete in Drupal 8
Same name and namespace in other branches
- 9 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 35
Class
- TermKernelTest
- Kernel tests for taxonomy term functions.
Namespace
Drupal\Tests\taxonomy\KernelCode
public function testTermDelete() {
$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
->assertTrue(empty($terms), 'Vocabulary is empty after deletion');
}