You are here

public function PathautoKernelTest::testCreateNodeWhileAccessingPath in Pathauto 8

Tests that the pathauto state property gets set to CREATED for new nodes.

In some cases, this can trigger $node->path to be set up with no default value for the pathauto property.

File

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

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

public function testCreateNodeWhileAccessingPath() {
  $node = Node::create([
    'type' => 'article',
    'title' => 'TestAlias',
  ]);
  $node->path->langcode;
  $node
    ->save();
  $this
    ->assertEntityAlias($node, '/content/testalias');
}