You are here

protected function ImportExportTestBase::decodeDataByObjectType in Acquia Content Hub 8.2

Decodes a data depending on object type.

Parameters

string $data: The data to be decoded.

string $object_type: The object type.

Return value

mixed The decoded object.

2 calls to ImportExportTestBase::decodeDataByObjectType()
ImportExportTestBase::assertExportedConfigEntities in tests/src/Kernel/ImportExportTestBase.php
Executes assertions on a set of exported configuration entities.
ImportExportTestBase::contentEntityImportExport in tests/src/Kernel/ImportExportTestBase.php
Import and export content.

File

tests/src/Kernel/ImportExportTestBase.php, line 634

Class

ImportExportTestBase
Base for testing exports and imports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function decodeDataByObjectType(string $data, string $object_type) {
  switch ($object_type) {
    case 'drupal8_config_entity':
      return Yaml::decode(base64_decode($data));
    case 'drupal8_content_entity':
    default:
      return json_decode(base64_decode($data), TRUE);
  }
}