You are here

protected function MultilingualTest::expectedState in Entity Share 8.3

Same name and namespace in other branches
  1. 8.2 modules/entity_share_client/tests/src/Functional/MultilingualTest.php \Drupal\Tests\entity_share_client\Functional\MultilingualTest::expectedState()

Helper function.

Parameters

string $en_expected_state: The expected state for the en translation.

string $fr_expected_state: The expected state for the fr translation.

array $overrides: Manipulations to do on JSON:API data attributes, per language.

1 call to MultilingualTest::expectedState()
MultilingualTest::testMultilingualImport in modules/entity_share_client/tests/src/Functional/MultilingualTest.php
Test several scenarios of importing the multilingual entities.

File

modules/entity_share_client/tests/src/Functional/MultilingualTest.php, line 203

Class

MultilingualTest
General functional test class for multilingual scenarios.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function expectedState($en_expected_state, $fr_expected_state, array $overrides = []) {
  $json_data = $this
    ->getEntityJsonData('node_es_test_en', 'es_test');
  if (!empty($overrides['en'])) {
    $json_data['attributes'] = $this
      ->overrideJsonDataAttributes($overrides['en'], $json_data['attributes']);
  }
  $status = $this->stateInformation
    ->getStatusInfo($json_data);
  $this
    ->assertEquals($status['info_id'], $en_expected_state);
  $json_data = $this
    ->getEntityJsonData('node_es_test_fr', 'es_test');
  if (!empty($overrides['fr'])) {
    $json_data['attributes'] = $this
      ->overrideJsonDataAttributes($overrides['fr'], $json_data['attributes']);
  }
  $status = $this->stateInformation
    ->getStatusInfo($json_data);
  $this
    ->assertEquals($status['info_id'], $fr_expected_state);
}