protected function MediaResourceTestBase::getExpectedNormalizedFileEntity in Drupal 8
Same name and namespace in other branches
- 9 core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php \Drupal\Tests\media\Functional\Rest\MediaResourceTestBase::getExpectedNormalizedFileEntity()
- 10 core/modules/media/tests/src/Functional/Rest/MediaResourceTestBase.php \Drupal\Tests\media\Functional\Rest\MediaResourceTestBase::getExpectedNormalizedFileEntity()
Gets the expected file entity.
Return value
array The expected normalized data array.
2 calls to MediaResourceTestBase::getExpectedNormalizedFileEntity()
- MediaHalJsonAnonTest::getExpectedNormalizedFileEntity in core/
modules/ media/ tests/ src/ Functional/ Hal/ MediaHalJsonAnonTest.php - Gets the expected file entity.
- MediaResourceTestBase::uploadFile in core/
modules/ media/ tests/ src/ Functional/ Rest/ MediaResourceTestBase.php - This duplicates some of the 'file_upload' REST resource plugin test coverage, to be able to test it on a concrete use case.
1 method overrides MediaResourceTestBase::getExpectedNormalizedFileEntity()
- MediaHalJsonAnonTest::getExpectedNormalizedFileEntity in core/
modules/ media/ tests/ src/ Functional/ Hal/ MediaHalJsonAnonTest.php - Gets the expected file entity.
File
- core/
modules/ media/ tests/ src/ Functional/ Rest/ MediaResourceTestBase.php, line 386
Class
Namespace
Drupal\Tests\media\Functional\RestCode
protected function getExpectedNormalizedFileEntity() {
$file = File::load(3);
$owner = static::$auth ? $this->account : User::load(0);
return [
'fid' => [
[
'value' => 3,
],
],
'uuid' => [
[
'value' => $file
->uuid(),
],
],
'langcode' => [
[
'value' => 'en',
],
],
'uid' => [
[
'target_id' => (int) $owner
->id(),
'target_type' => 'user',
'target_uuid' => $owner
->uuid(),
'url' => base_path() . 'user/' . $owner
->id(),
],
],
'filename' => [
[
'value' => 'drupal rocks 🤘.txt',
],
],
'uri' => [
[
'value' => 'public://' . date('Y-m') . '/drupal rocks 🤘.txt',
'url' => base_path() . $this->siteDirectory . '/files/' . date('Y-m') . '/drupal%20rocks%20%F0%9F%A4%98.txt',
],
],
'filemime' => [
[
'value' => 'text/plain',
],
],
'filesize' => [
[
'value' => 19,
],
],
'status' => [
[
'value' => FALSE,
],
],
'created' => [
$this
->formatExpectedTimestampItemValues($file
->getCreatedTime()),
],
'changed' => [
$this
->formatExpectedTimestampItemValues($file
->getChangedTime()),
],
];
}