You are here

protected function PathautoKernelTest::drupalCreateNode in Pathauto 8

Creates a node programmatically.

Parameters

array $settings: The array of values for the node.

Return value

\Drupal\node\Entity\Node The created node.

8 calls to PathautoKernelTest::drupalCreateNode()
PathautoKernelTest::testDefaultRevision in tests/src/Kernel/PathautoKernelTest.php
Tests that aliases are only generated for default revisions.
PathautoKernelTest::testNoExistingPathAliases in tests/src/Kernel/PathautoKernelTest.php
PathautoKernelTest::testNoTokensNoAlias in tests/src/Kernel/PathautoKernelTest.php
Test that \Drupal::service('pathauto.generator')->createEntityAlias() will not create an alias for a pattern that does not get any tokens replaced.
PathautoKernelTest::testPathAliasUniquifyWordsafe in tests/src/Kernel/PathautoKernelTest.php
Tests word safe alias truncating.
PathautoKernelTest::testPatternStatus in tests/src/Kernel/PathautoKernelTest.php
Test if aliases are (not) generated with enabled/disabled patterns.

... See full list

File

tests/src/Kernel/PathautoKernelTest.php, line 591

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

protected function drupalCreateNode(array $settings = []) {

  // Populate defaults array.
  $settings += [
    'title' => $this
      ->randomMachineName(8),
    'type' => 'page',
  ];
  $node = Node::create($settings);
  $node
    ->save();
  return $node;
}