function DbLogTest::getContent

Same name and namespace in other branches
  1. 8.9.x core/modules/dblog/tests/src/Functional/DbLogTest.php \Drupal\Tests\dblog\Functional\DbLogTest::getContent()

Creates random content based on node content type.

Parameters

string $type: Node content type (e.g., 'article').

Return value

array Random content needed by various node types.

1 call to DbLogTest::getContent()
DbLogTest::doNode in core/modules/dblog/tests/src/Functional/DbLogTest.php
Generates and then verifies some node events.

File

core/modules/dblog/tests/src/Functional/DbLogTest.php, line 585

Class

DbLogTest
Verifies log entries and user access based on permissions.

Namespace

Drupal\Tests\dblog\Functional

Code

private function getContent($type) {
  switch ($type) {
    case 'forum':
      $content = [
        'title[0][value]' => $this->randomMachineName(8),
        'taxonomy_forums' => 1,
        'body[0][value]' => $this->randomMachineName(32),
      ];
      break;

    default:
      $content = [
        'title[0][value]' => $this->randomMachineName(8),
        'body[0][value]' => $this->randomMachineName(32),
      ];
      break;

  }
  return $content;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.