protected function TaxonomyImportTest::assertTaxonomy in YAML Content 8
Assert that a given entity is a taxonomy term.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity object being checked.
string $title: The expected label of the entity argument.
int $vid: The expected vocabulary ID of the entity argument.
1 call to TaxonomyImportTest::assertTaxonomy()
- TaxonomyImportTest::testCanCreateNode in tests/
src/ Functional/ TaxonomyImportTest.php - Create a basic node.
File
- tests/
src/ Functional/ TaxonomyImportTest.php, line 88
Class
- TaxonomyImportTest
- Tests general Node creation functionality.
Namespace
Drupal\Tests\yaml_content\FunctionalCode
protected function assertTaxonomy(EntityInterface $entity, $title, $vid) {
$this
->assertEquals('taxonomy_term', $entity
->getEntityTypeId(), 'Entity type should be taxonomy_term');
$this
->assertEquals([
'target_id' => $vid,
], $entity
->get('vid')
->get(0)
->getValue(), 'Vocabulary id is populated');
$this
->assertEquals($title, $entity
->label(), 'Term name is populated.');
}