You are here

protected function ImportExportTestBase::cleanLineEndings in Acquia Content Hub 8.2

Standardize OS line endings for the sake of comparison.

Parameters

array|string $value: The value to process.

Return value

array|string|string[]|null Returns the submitted value with standardized line endings.

1 call to ImportExportTestBase::cleanLineEndings()
ImportExportTestBase::contentEntityImportExport in tests/src/Kernel/ImportExportTestBase.php
Import and export content.

File

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

Class

ImportExportTestBase
Base for testing exports and imports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function cleanLineEndings($value) {
  if (is_string($value)) {
    $value = preg_replace('/(\\r\\n|\\n\\r|\\r)/', "\n", $value);
  }
  if (is_array($value)) {
    array_walk_recursive($value, function (&$item) {
      $item = $this
        ->cleanLineEndings($item);
    });
  }
  return $value;
}