You are here

public function LingotekTargetStatusFormatterUpdate8209Test::testUpgrade in Lingotek Translation 8.2

Tests that the upgrade sets the correct field formatter id in a view.

File

tests/src/Functional/Update/LingotekTargetStatusFormatterUpdate8209Test.php, line 44

Class

LingotekTargetStatusFormatterUpdate8209Test
Tests the upgrade path for changing the lingotek_target_status id to lingotek_target_statuses.

Namespace

Drupal\Tests\lingotek\Functional\Update

Code

public function testUpgrade() {
  $view = $this->configFactory
    ->get('views.view.lingotektargetstatusupgrade2985742');
  $field_type = $view
    ->get('display.default.display_options.fields.translation_status_value.type');
  $this
    ->assertEquals($field_type, 'lingotek_translation_status');
  $this
    ->runUpdates();
  $view = $this->configFactory
    ->get('views.view.lingotektargetstatusupgrade2985742');
  $field_type = $view
    ->get('display.default.display_options.fields.translation_status_value.type');
  $this
    ->assertEquals($field_type, 'lingotek_translation_statuses');
  $basepath = \Drupal::request()
    ->getBasePath();
  $this
    ->drupalGet('/lingotektargetstatusupgrade2985742');
  $this
    ->assertSession()
    ->responseNotContains('IGNORED-SEPARATOR');
  $this
    ->assertSession()
    ->responseContains('<a href="' . $basepath . '/admin/lingotek/entity/add_target/document_id_1/de_DE?destination=' . $basepath . '/lingotektargetstatusupgrade2985742" class="language-icon target-request" title="German - Request translation">DE</a><a href="' . $basepath . '/admin/lingotek/workbench/document_id_1/es_ES" target="_blank" class="language-icon target-current" title="Spanish - Current">ES</a>');
}