You are here

public function PathautoKernelTest::testNoTokensNoAlias in Pathauto 8

Test that \Drupal::service('pathauto.generator')->createEntityAlias() will not create an alias for a pattern that does not get any tokens replaced.

File

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

Class

PathautoKernelTest
Unit tests for Pathauto functions.

Namespace

Drupal\Tests\pathauto\Kernel

Code

public function testNoTokensNoAlias() {
  $this
    ->installConfig([
    'filter',
  ]);
  $this->nodePattern
    ->setPattern('/content/[node:body]')
    ->save();
  $node = $this
    ->drupalCreateNode();
  $this
    ->assertNoEntityAliasExists($node);
  $node->body->value = 'hello';
  $node
    ->save();
  $this
    ->assertEntityAlias($node, '/content/hello');
}