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;
class LingotekRouteNamesRequestTranslation8003Test extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../tests/fixtures/update/drupal-8.lingotek.standard.pre8003.php.gz',
];
}
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) {
$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();
$this
->assertTrue(TRUE, 'The route was found after the update.');
} catch (RouteNotFoundException $exception) {
$this
->fail('The route did not exist');
}
}
}