protected function ExportTest::validateTaxonomyVocabularyCdfObject in Acquia Content Hub 8.2
Validates taxonomy vocabulary CDF object.
Parameters
string $vid_expected: Expected vocabulary id.
string $name_expected: Expected vocabulary name.
string $description_expected: Expected vocabulary description.
int $weight_expected: Expected vocabulary weight.
File
- tests/
src/ Kernel/ ExportTest.php, line 1745
Class
- ExportTest
- Tests entity exports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
protected function validateTaxonomyVocabularyCdfObject($vid_expected, $name_expected, $description_expected, $weight_expected) {
$this
->validateBaseCdfObject();
$cdf = $this->cdfObject;
// Validate Type attribute.
$type = $cdf
->getType();
$this
->assertEquals('drupal8_config_entity', $type);
// Validate Metadata attribute.
$metadata = $cdf
->getMetadata();
$metadata_expected = [
'default_language' => 'en',
'dependencies' => [
'module' => [
'taxonomy',
],
],
];
unset($metadata['data']);
$this
->assertEquals($metadata_expected, $metadata);
// Validate "Data" attribute.
$data = $this
->getCdfDataAttribute($cdf);
$data_expected = [
'en' => [
'uuid' => $cdf
->getUuid(),
'langcode' => 'en',
'status' => TRUE,
'dependencies' => [],
'name' => $name_expected,
'vid' => $vid_expected,
'description' => $description_expected,
'weight' => $weight_expected,
],
];
$this
->assertEquals($data_expected, $data);
// Validate entity type.
$entity_type = $this
->getCdfAttribute($cdf, 'entity_type');
$this
->assertEquals('taxonomy_vocabulary', $entity_type);
// Validate vocabulary name.
$name = $this
->getCdfAttribute($cdf, 'label', 'en');
$this
->assertEquals($name_expected, $name);
}