You are here

public function PathautoKernelTest::testPathAliasUniquifyWordsafe in Pathauto 8

Tests word safe alias truncating.

File

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

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

public function testPathAliasUniquifyWordsafe() {
  $this
    ->config('pathauto.settings')
    ->set('max_length', 26)
    ->save();
  $node_1 = $this
    ->drupalCreateNode([
    'title' => 'thequick brownfox jumpedover thelazydog',
    'type' => 'page',
  ]);
  $node_2 = $this
    ->drupalCreateNode([
    'title' => 'thequick brownfox jumpedover thelazydog',
    'type' => 'page',
  ]);

  // Check that alias uniquifying is truncating with $wordsafe param set to
  // TRUE.
  // If it doesn't path alias result would be content/thequick-brownf-0
  $this
    ->assertEntityAlias($node_1, '/content/thequick-brownfox');
  $this
    ->assertEntityAlias($node_2, '/content/thequick-0');
}