You are here

LingotekRouteNamesRequestTranslation8003Test.php in Lingotek Translation 8

File

src/Tests/Update/LingotekRouteNamesRequestTranslation8003Test.php
View source
<?php

namespace Drupal\lingotek\Tests\Update;

use Drupal\Core\Url;
use Drupal\system\Tests\Update\UpdatePathTestBase;
use Symfony\Component\Routing\Exception\RouteNotFoundException;

/**
 * Tests the upgrade path after changing route names.
 *
 * @group lingotek
 */
class LingotekRouteNamesRequestTranslation8003Test extends UpdatePathTestBase {

  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../tests/fixtures/update/drupal-8.lingotek.standard.pre8003.php.gz',
    ];
  }

  /**
   * Tests that the entity definition is loaded correctly.
   */
  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');
    }
  }

}

Classes

Namesort descending Description
LingotekRouteNamesRequestTranslation8003Test Tests the upgrade path after changing route names.