You are here

public function StaticGeneratorTest::testLanguagePathPrefix in Tome 8

@covers \Drupal\tome_static\EventSubscriber\LanguagePathSubscriber::collectPaths

File

modules/tome_static/tests/src/Kernel/StaticGeneratorTest.php, line 107

Class

StaticGeneratorTest
Tests that static site generation works.

Namespace

Drupal\Tests\tome_static\Kernel

Code

public function testLanguagePathPrefix() {
  $this
    ->enableModules([
    'tome_test',
  ]);

  /** @var \Drupal\tome_static\StaticGenerator $static */
  $static = \Drupal::service('tome_static.generator');
  $this
    ->assertUnsortedEquals([
    '/',
    '/tome-test/page',
    '/tome-test/complex-page',
    '/tome-test/pager-page',
    '/tome-test/oembed-page',
    '/french',
    '/french/tome-test/page',
    '/french/tome-test/complex-page',
    '/french/tome-test/pager-page',
    '/french/tome-test/oembed-page',
    '_entity:user:en:0',
  ], $static
    ->getPaths());
  $this
    ->config('language.negotiation')
    ->set('url.prefixes', [
    'en' => 'english',
    'fr' => 'french',
  ])
    ->save();
  $this
    ->assertUnsortedEquals([
    '/',
    '/tome-test/complex-page',
    '/tome-test/oembed-page',
    '/tome-test/page',
    '/tome-test/pager-page',
    '/english',
    '/english/tome-test/complex-page',
    '/english/tome-test/oembed-page',
    '/english/tome-test/page',
    '/english/tome-test/pager-page',
    '/french',
    '/french/tome-test/complex-page',
    '/french/tome-test/oembed-page',
    '/french/tome-test/page',
    '/french/tome-test/pager-page',
    '_entity:user:en:0',
  ], $static
    ->getPaths());
}