You are here

public function LingotekRouteNamesRequestTranslation8003Test::testRouteName in Lingotek Translation 8

Tests that the entity definition is loaded correctly.

File

src/Tests/Update/LingotekRouteNamesRequestTranslation8003Test.php, line 28

Class

LingotekRouteNamesRequestTranslation8003Test
Tests the upgrade path after changing route names.

Namespace

Drupal\lingotek\Tests\Update

Code

public function testRouteName() {
  $document_id = 'my_document_id';
  $locale = 'es_ES';
  $url = Url::fromRoute('lingotek.entity.request_translation', [
    'doc_id' => $document_id,
    'locale' => $locale,
  ]);
  try {
    $url
      ->getInternalPath();
    $this
      ->fail('The route did not exist');
  } catch (RouteNotFoundException $exception) {

    // We are good.
    $this
      ->assertTrue(TRUE, 'The route was not found before the update.');
  }
  $this
    ->runUpdates();
  $url = Url::fromRoute('lingotek.entity.request_translation', [
    'doc_id' => $document_id,
    'locale' => $locale,
  ]);
  try {
    $url
      ->getInternalPath();

    // We are good.
    $this
      ->assertTrue(TRUE, 'The route was found after the update.');
  } catch (RouteNotFoundException $exception) {
    $this
      ->fail('The route did not exist');
  }
}