You are here

public function LingotekActionsInstalledUpdate8210Test::testUpgrade in Lingotek Translation 8.2

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

File

tests/src/Functional/Update/LingotekActionsInstalledUpdate8210Test.php, line 43

Class

LingotekActionsInstalledUpdate8210Test
Tests the upgrade path for installing the lingotek actions if required.

Namespace

Drupal\Tests\lingotek\Functional\Update

Code

public function testUpgrade() {
  $actions = Action::loadMultiple();
  $this
    ->assertCount(19, $actions);
  $this
    ->runUpdates();
  $actions = Action::loadMultiple();

  // There should be 6 new actions: 5 steps in the complete roundtrip plus the
  // action for disassociating.
  // After lingotek_update_8214 count on 9 more.
  // After lingotek_update_8216 count on 4 more.
  // After lingotek_update_8219 count on 3 more.
  $this
    ->assertCount(19 + 6 + 9 + 4 + 3, $actions);
  $expectedActions = [
    'node_lingotek_upload_action',
    'node_lingotek_check_upload_action',
    'node_lingotek_request_translations_action',
    'node_lingotek_check_translations_action',
    'node_lingotek_download_translations_action',
    // After lingotek_update_8219 cancel replaces disassociate.
    // 'node_lingotek_disassociate_action',
    'node_lingotek_cancel_action',
  ];
  foreach ($expectedActions as $expectedAction) {
    $this
      ->assertArrayHasKey($expectedAction, $actions, 'There is an action with id: ' . $expectedAction);
  }
}