public function ExtraFieldBrowserTestBase::createContent in Extra Field 8
Same name and namespace in other branches
- 8.2 tests/src/Functional/ExtraFieldBrowserTestBase.php \Drupal\Tests\extra_field\Functional\ExtraFieldBrowserTestBase::createContent()
Creates a node.
Parameters
string $contentType: Content type of the node.
Return value
\Drupal\Core\Entity\ContentEntityInterface The new node.
2 calls to ExtraFieldBrowserTestBase::createContent()
- ExtraFieldDisplayFieldTest::setUp in tests/
src/ Functional/ ExtraFieldDisplayFieldTest.php - ExtraFieldDisplayViewTest::setUp in tests/
src/ Functional/ ExtraFieldDisplayViewTest.php
File
- tests/
src/ Functional/ ExtraFieldBrowserTestBase.php, line 56
Class
- ExtraFieldBrowserTestBase
- Base class for Extra Field browser tests.
Namespace
Drupal\Tests\extra_field\FunctionalCode
public function createContent($contentType) {
$this
->createContentType([
'type' => $contentType,
]);
/** @var \Drupal\Core\Entity\ContentEntityInterface $node */
$node = \Drupal::entityTypeManager()
->getStorage('node')
->create([
'type' => $contentType,
'title' => $this
->randomMachineName(),
]);
$node
->save();
return $node;
}