You are here

public function Pathautoi18nNodeTest::createNode in Pathauto i18n 8

Helper to create node.

File

src/Tests/Pathautoi18nNodeTest.php, line 129
Tests for the pathauto_i18n node module.

Class

Pathautoi18nNodeTest
Pathauto i18n test functionality for nodes.

Namespace

Drupal\pathauto_i18n\Tests

Code

public function createNode($language, $pathauto_i18n_status, $pathauto, $alias = FALSE) {
  $settings = array(
    'type' => 'article',
    'title' => $this->title,
    'body' => array(
      $language => array(
        array(
          $this
            ->randomName(64),
        ),
      ),
    ),
    'language' => $language,
    'path' => array(
      'pathauto_i18n_status' => $pathauto_i18n_status,
      'pathauto' => $pathauto,
    ),
  );
  if (!empty($alias)) {
    $settings['path']['alias'] = $alias;
  }
  $node = $this
    ->drupalCreateNode($settings);
}