You are here

protected function LogCreationTrait::createLogEntity in Log entity 2.x

Creates a log entity.

Parameters

array $values: Array of values to feed the entity.

Return value

\Drupal\log\Entity\LogInterface The log entity.

Throws

\Drupal\Core\Entity\EntityStorageException

5 calls to LogCreationTrait::createLogEntity()
LogActionsTest::testMarkAsDoneAction in tests/src/Kernel/LogActionsTest.php
Tests that the mark as done action sets the right state.
LogActionsTest::testMarkAsPendingAction in tests/src/Kernel/LogActionsTest.php
Tests that the mark as pending action sets the right state.
NameAutocompleteTest::setUp in tests/src/Kernel/NameAutocompleteTest.php
NameAutocompleteTest::testLogNameAutocompleteMultipleLogs in tests/src/Kernel/NameAutocompleteTest.php
Tests the order of logs returned.
SortTimestampIdTest::setUp in tests/src/Kernel/SortTimestampIdTest.php

File

tests/src/Traits/LogCreationTrait.php, line 25

Class

LogCreationTrait
Provides methods to create log entities.

Namespace

Drupal\Tests\log\Traits

Code

protected function createLogEntity(array $values = []) {

  /** @var \Drupal\log\Entity\LogInterface $entity */
  $entity = Log::create($values + [
    'name' => $this
      ->randomMachineName(),
    'type' => 'default',
  ]);
  $entity
    ->save();
  return $entity;
}