You are here

public function PathautoKernelTest::testDefaultRevision in Pathauto 8

Tests that aliases are only generated for default revisions.

File

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

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

public function testDefaultRevision() {
  $node1 = $this
    ->drupalCreateNode([
    'title' => 'Default revision',
    'type' => 'page',
  ]);
  $this
    ->assertEntityAlias($node1, '/content/default-revision');
  $node1
    ->setNewRevision(TRUE);
  $node1
    ->isDefaultRevision(FALSE);
  $node1
    ->setTitle('New non-default-revision');
  $node1
    ->save();
  $this
    ->assertEntityAlias($node1, '/content/default-revision');
}