You are here

public function DefaultContentTest::setUp in Wysiwyg API template plugin 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Tests/DefaultContentTest.php \Drupal\wysiwyg_template\Tests\DefaultContentTest::setUp()

Overrides BrowserTestBase::setUp

File

src/Tests/DefaultContentTest.php, line 45

Class

DefaultContentTest
Test the ability to specify a template as default content for a node.

Namespace

Drupal\wysiwyg_template\Tests

Code

public function setUp() {
  parent::setUp();
  foreach (range(1, 2) as $i) {
    $this->templates[$i] = Template::create([
      'id' => strtolower($this
        ->randomMachineName()),
      'label' => $this
        ->randomString(),
      'body' => [
        'value' => $this
          ->randomString(),
      ],
    ]);
    $this->templates[$i]
      ->save();
  }
  $this->nodeType = $this
    ->createContentType([
    'type' => strtolower($this
      ->randomMachineName()),
    'name' => $this
      ->randomString(),
  ]);
  $this->nodeType
    ->save();
  $this->admin = $this
    ->createUser([], NULL, TRUE);
  $this
    ->drupalLogin($this->admin);
}