You are here

public function LogTest::testLogTemplate in Commerce Core 8.2

Tests log generated on EntityTest create.

File

modules/log/tests/src/Kernel/LogTest.php, line 38

Class

LogTest
Tests log generation.

Namespace

Drupal\Tests\commerce_log\Kernel

Code

public function testLogTemplate() {
  $entity = EntityTest::create([
    'name' => 'Camelids',
    'type' => 'bar',
  ]);
  $entity
    ->save();
  $log = Log::load(1);
  $this
    ->assertNotNull($log);
  $view = $this->container
    ->get('entity_type.manager')
    ->getViewBuilder($log
    ->getEntityTypeId())
    ->view($log);
  $this
    ->render($view);
  $this
    ->assertText("{$entity->label()} was created.");
}