You are here

public function PathautoSettingsFormWebTest::testSettingsForm in Pathauto 8

Tests generating aliases with different settings.

File

tests/src/Functional/PathautoSettingsFormWebTest.php, line 152

Class

PathautoSettingsFormWebTest
Tests pathauto settings form.

Namespace

Drupal\Tests\pathauto\Functional

Code

public function testSettingsForm() {

  // Ensure the separator settings apply correctly.
  $this
    ->checkAlias('My awesome content', '/content/my.awesome.content', [
    'separator' => '.',
  ]);

  // Ensure the character case setting works correctly.
  // Leave case the same as source token values.
  $this
    ->checkAlias('My awesome Content', '/content/My-awesome-Content', [
    'case' => FALSE,
  ]);
  $this
    ->checkAlias('Change Lower', '/content/change-lower', [
    'case' => '1',
  ]);

  // Ensure the maximum alias length is working.
  $this
    ->checkAlias('My awesome Content', '/content/my-awesome', [
    'max_length' => '23',
  ]);

  // Ensure the maximum component length is working.
  $this
    ->checkAlias('My awesome Content', '/content/my', [
    'max_component_length' => '2',
  ]);

  // Ensure transliteration option is working.
  $this
    ->checkAlias('è é àl ö äl ü', '/content/e-e-al-o-al-u', [
    'transliterate' => '1',
  ]);
  $this
    ->checkAlias('è é àl äl ö ü', '/content/è-é-àl-äl-ö-ü', [
    'transliterate' => FALSE,
  ]);
  $ignore_words = 'a, new, very, should';
  $this
    ->checkAlias('a very new alias to test', '/content/alias-to-test', [
    'ignore_words' => $ignore_words,
  ]);
}