You are here

protected function FileTest::getReplacedFileInfo in Entity Share 8.3

Get the replaced file infos.

Parameters

array $file_data: The file's data with the same structure as in static::$filesData.

Return value

array The array of data for the replaced file. Same structure as input.

1 call to FileTest::getReplacedFileInfo()
FileTest::testBasicPull in modules/entity_share_client/tests/src/Functional/FileTest.php
Test basic pull feature.

File

modules/entity_share_client/tests/src/Functional/FileTest.php, line 422

Class

FileTest
Functional test class for file field.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function getReplacedFileInfo(array $file_data) {
  $replaced_file_data = $file_data;
  $uri = $file_data['uri'];
  $filename = $file_data['filename'];

  // Generate replaced file name.
  $parts = pathinfo($filename);
  $replaced_file_name = $parts['filename'] . '_0.' . $parts['extension'];
  $replaced_file_data['filename'] = $replaced_file_name;

  // Generate replaced URI.
  $replaced_file_data['uri'] = str_replace($filename, $replaced_file_name, $uri);
  return $replaced_file_data;
}