You are here

public function LogNamePatternTest::testCreateLogWithoutName in Log entity 2.x

Tests creating a log entity without name.

File

tests/src/Functional/LogNamePatternTest.php, line 19

Class

LogNamePatternTest
Tests the Log name pattern.

Namespace

Drupal\Tests\log\Functional

Code

public function testCreateLogWithoutName() {
  $edit = [
    'status' => 'done',
  ];
  $this
    ->drupalPostForm('log/add/name_pattern', $edit, $this
    ->t('Save'));
  $result = $this->storage
    ->getQuery()
    ->range(0, 1)
    ->execute();
  $log_id = reset($result);
  $log = $this->storage
    ->load($log_id);
  $this
    ->assertEquals($log
    ->label(), $log_id . ' done', 'Log name is the pattern and not the name.');
  $this
    ->drupalGet($log
    ->toUrl('canonical'));
  $this
    ->assertResponse(200);
  $this
    ->assertText($log_id);
}