protected function TermParentsTest::submitAddTermForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/taxonomy/tests/src/Functional/TermParentsTest.php \Drupal\Tests\taxonomy\Functional\TermParentsTest::submitAddTermForm()
Creates a term through the user interface and returns it.
Parameters
string $name: The name of the term to create.
Return value
\Drupal\taxonomy\TermInterface The newly created taxonomy term.
1 call to TermParentsTest::submitAddTermForm()
- TermParentsTest::testAddWithParents in core/
modules/ taxonomy/ tests/ src/ Functional/ TermParentsTest.php - Tests specifying parents when creating terms.
File
- core/
modules/ taxonomy/ tests/ src/ Functional/ TermParentsTest.php, line 117
Class
- TermParentsTest
- Tests managing taxonomy parents through the user interface.
Namespace
Drupal\Tests\taxonomy\FunctionalCode
protected function submitAddTermForm($name) {
$this
->getSession()
->getPage()
->fillField('Name', $name);
$this
->submitForm([], 'Save');
$result = $this->termStorage
->getQuery()
->accessCheck(FALSE)
->condition('name', $name)
->execute();
/** @var \Drupal\taxonomy\TermInterface $term_1 */
$term_1 = $this->termStorage
->load(reset($result));
$this
->assertInstanceOf(TermInterface::class, $term_1);
return $term_1;
}