You are here

protected function GeshiFieldTest::addNode in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 geshifield/tests/src/Functional/GeshiFieldTest.php \Drupal\Tests\geshifield\Functional\GeshiFieldTest::addNode()

Add a new node.

Parameters

string $title: Title of node.

string $body: Body content of node.

string $sourcecode: The content of geshifield in node.

string $language: The language used in geshifield.

1 call to GeshiFieldTest::addNode()
GeshiFieldTest::testAddField in geshifield/tests/src/Functional/GeshiFieldTest.php
Test if we can add the field and a node on it.

File

geshifield/tests/src/Functional/GeshiFieldTest.php, line 129

Class

GeshiFieldTest
Tests for GeshiField in node content.

Namespace

Drupal\Tests\geshifield\Functional

Code

protected function addNode($title, $body, $sourcecode, $language) {

  // Create a node.
  $node = [
    'title[0][value]' => $title,
    'body[0][value]' => $body,
    'field_geshi[0][sourcecode]' => $sourcecode,
    'field_geshi[0][language]' => $language,
  ];
  $this
    ->drupalPostForm('node/add/geshifilter_content_type', $node, 'Save');
  $this
    ->drupalGet('node/1');
}