protected function Select2BoxesTestsBase::generateDummyTerms in Select2 Boxes 8
Generates a specified number of terms within a specific vocabulary.
Parameters
string $vid: Taxonomy vocabulary ID.
int $count: Number of terms that needs to be generated.
Return value
\Drupal\taxonomy\Entity\Term[] Generated terms objects.
5 calls to Select2BoxesTestsBase::generateDummyTerms()
- Select2BefTests::testFilterForTagFields in modules/
select2_bef/ tests/ src/ FunctionalJavascript/ Select2BefTests.php - Test filter for tag fields.
- Select2BefTests::testListExposedFilters in modules/
select2_bef/ tests/ src/ FunctionalJavascript/ Select2BefTests.php - Test list exposed filters.
- Select2BoxesTests::testMultipleWidget in tests/
src/ FunctionalJavascript/ Select2BoxesTests.php - Test multiple widget for entity reference fields.
- Select2BoxesTests::testPreloading in tests/
src/ FunctionalJavascript/ Select2BoxesTests.php - Test preloading functionality for the multiple entity reference widgets.
- Select2BoxesTests::testUnlimitedPreloading in tests/
src/ FunctionalJavascript/ Select2BoxesTests.php - Test unlimited preloading behavior.
File
- tests/
src/ FunctionalJavascript/ Select2BoxesTestsBase.php, line 83
Class
- Select2BoxesTestsBase
- Class Select2BoxesTestsBase.
Namespace
Drupal\Tests\select2boxes\FunctionalJavascriptCode
protected function generateDummyTerms($vid, $count) {
$terms = [];
for ($i = 0; $i < $count; $i++) {
$terms[$i] = Term::create([
'vid' => $vid,
'name' => $this
->randomString(4),
]);
$terms[$i]
->save();
}
return $terms;
}