public function RadioactivityFunctionTestTrait::createContent in Radioactivity 8.3
Same name and namespace in other branches
- 4.0.x tests/src/Traits/RadioactivityFunctionTestTrait.php \Drupal\Tests\radioactivity\Traits\RadioactivityFunctionTestTrait::createContent()
Creates an entity.
Return value
\Drupal\Core\Entity\ContentEntityInterface The created entity.
2 calls to RadioactivityFunctionTestTrait::createContent()
- EmitTest::testCount in tests/
src/ FunctionalJavascript/ EmitTest.php - Tests Radioactivity count functionality.
- EmitTest::testUnpublished in tests/
src/ FunctionalJavascript/ EmitTest.php - Validate that no energy is emitted if entity is unpublished.
File
- tests/
src/ Traits/ RadioactivityFunctionTestTrait.php, line 280
Class
- RadioactivityFunctionTestTrait
- Radioactivity functional test trait.
Namespace
Drupal\Tests\radioactivity\TraitsCode
public function createContent() {
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = \Drupal::entityTypeManager()
->getStorage($this->entityType)
->create([
'type' => $this->entityType,
'title' => $this
->randomString(),
]);
$entity
->save();
return $entity;
}