You are here

public function AutoEntityLabelTest::testEscapeOption in Automatic Entity Label 8.3

Tests node creation with 'Remove special characters' option selected.

File

tests/src/Kernel/AutoEntityLabelTest.php, line 126

Class

AutoEntityLabelTest
Tests for auto entity label.

Namespace

Drupal\Tests\auto_entitylabel\Kernel

Code

public function testEscapeOption() {
  $this
    ->setConfiguration([
    'status' => AutoEntityLabelManager::ENABLED,
    'pattern' => '[node:author:name] -?;: testing  123 ><*+',
    'escape' => TRUE,
  ]);
  $user = $this
    ->createUser();
  $node = $this
    ->createNode([
    'uid' => $user
      ->id(),
    'type' => $this->nodeType
      ->id(),
  ]);
  $this
    ->assertEquals($user
    ->getAccountName() . ' testing 123', $node
    ->getTitle(), 'The title is set.');
}