You are here

public function WebformEntityTest::testPaths in Webform 6.x

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/Entity/WebformEntityTest.php \Drupal\Tests\webform\Kernel\Entity\WebformEntityTest::testPaths()

Test paths.

File

tests/src/Kernel/Entity/WebformEntityTest.php, line 337

Class

WebformEntityTest
Tests the webform entity class.

Namespace

Drupal\Tests\webform\Kernel\Entity

Code

public function testPaths() {
  $this
    ->installEntitySchema('path_alias');
  $this
    ->installSchema('webform', [
    'webform',
  ]);
  $this
    ->installConfig('webform');

  /** @var \Drupal\webform\WebformInterface $webform */
  $webform = Webform::create([
    'id' => 'webform_test',
  ]);
  $webform
    ->save();
  $aliases = \Drupal::database()
    ->query('SELECT path, alias FROM {path_alias}')
    ->fetchAllKeyed();
  $this
    ->assertEquals($aliases['/webform/webform_test'], '/form/webform-test');
  $this
    ->assertEquals($aliases['/webform/webform_test/confirmation'], '/form/webform-test/confirmation');
  $this
    ->assertEquals($aliases['/webform/webform_test/submissions'], '/form/webform-test/submissions');
}