protected function FileResourceTestBase::getExpectedNormalizedEntity in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedNormalizedEntity()
- 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedNormalizedEntity()
Returns the expected normalization of the entity.
Return value
array
Overrides EntityResourceTestBase::getExpectedNormalizedEntity
See also
::createEntity()
File
- core/
modules/ file/ tests/ src/ Functional/ Rest/ FileResourceTestBase.php, line 94
Class
Namespace
Drupal\Tests\file\Functional\RestCode
protected function getExpectedNormalizedEntity() {
return [
'changed' => [
[
'value' => (new \DateTime())
->setTimestamp($this->entity
->getChangedTime())
->setTimezone(new \DateTimeZone('UTC'))
->format(\DateTime::RFC3339),
'format' => \DateTime::RFC3339,
],
],
'created' => [
[
'value' => (new \DateTime())
->setTimestamp((int) $this->entity
->getCreatedTime())
->setTimezone(new \DateTimeZone('UTC'))
->format(\DateTime::RFC3339),
'format' => \DateTime::RFC3339,
],
],
'fid' => [
[
'value' => 1,
],
],
'filemime' => [
[
'value' => 'text/plain',
],
],
'filename' => [
[
'value' => 'drupal.txt',
],
],
'filesize' => [
[
'value' => (int) $this->entity
->getSize(),
],
],
'langcode' => [
[
'value' => 'en',
],
],
'status' => [
[
'value' => TRUE,
],
],
'uid' => [
[
'target_id' => (int) $this->author
->id(),
'target_type' => 'user',
'target_uuid' => $this->author
->uuid(),
'url' => base_path() . 'user/' . $this->author
->id(),
],
],
'uri' => [
[
'url' => base_path() . $this->siteDirectory . '/files/drupal.txt',
'value' => 'public://drupal.txt',
],
],
'uuid' => [
[
'value' => $this->entity
->uuid(),
],
],
];
}