protected function ExportTest::createTaxonomyTerms in Acquia Content Hub 8.2
Creates sample taxonomy terms.
Parameters
int $items_expected: Expected number of items in the queue.
array $cdf_expectations: The sets of expectation arguments for CDF object validation.
Return value
array List of taxonomy term ids.
Throws
\Drupal\Core\Entity\EntityStorageException
2 calls to ExportTest::createTaxonomyTerms()
- ExportTest::testPublishing in tests/
src/ Kernel/ ExportTest.php - Tests Acquia ContentHub content/configuration export.
- ExportTest::testQueue in tests/
src/ Kernel/ ExportTest.php - Tests Acquia ContentHub export queue.
File
- tests/
src/ Kernel/ ExportTest.php, line 821
Class
- ExportTest
- Tests entity exports.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
protected function createTaxonomyTerms(&$items_expected, array &$cdf_expectations = []) {
$bundle = 'test_vocabulary';
$this->termUuids = [];
$name1 = $this
->randomMachineName(20);
$description1 = $this
->randomMachineName(32);
$term1 = Term::create([
'description' => [
[
'value' => $description1,
],
],
'name' => $name1,
'vid' => $bundle,
'uid' => 1,
]);
$term1
->save();
$this->termUuids[] = $term1
->uuid();
$name2 = $this
->randomMachineName(20);
$description2 = $this
->randomMachineName(32);
$term2 = Term::create([
'description' => [
[
'value' => $description2,
],
],
'name' => $name2,
'vid' => $bundle,
'uid' => 2,
]);
$term2
->save();
$this->termUuids[] = $term2
->uuid();
$name3 = $this
->randomMachineName(20);
$description3 = $this
->randomMachineName(32);
$term3 = Term::create([
'description' => [
[
'value' => $description3,
],
],
'name' => $name3,
'vid' => $bundle,
'uid' => 3,
]);
$term3
->save();
$this->termUuids[] = $term3
->uuid();
$items_expected = 3;
$cdf_expectations = [
[
$name1,
$bundle,
$description1,
],
[
$name2,
$bundle,
$description2,
],
[
$name3,
$bundle,
$description3,
],
];
return [
$term1
->id(),
$term2
->id(),
$term3
->id(),
];
}