function FileResourceTestBase::getExpectedNormalizedEntity

Same name in other branches
  1. 9 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedNormalizedEntity()
  2. 10 core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedNormalizedEntity()
  3. 11.x core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php \Drupal\Tests\file\Functional\Rest\FileResourceTestBase::getExpectedNormalizedEntity()

Overrides EntityResourceTestBase::getExpectedNormalizedEntity

1 call to FileResourceTestBase::getExpectedNormalizedEntity()
FileHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/file/tests/src/Functional/Hal/FileHalJsonAnonTest.php
Returns the expected normalization of the entity.
1 method overrides FileResourceTestBase::getExpectedNormalizedEntity()
FileHalJsonAnonTest::getExpectedNormalizedEntity in core/modules/file/tests/src/Functional/Hal/FileHalJsonAnonTest.php
Returns the expected normalization of the entity.

File

core/modules/file/tests/src/Functional/Rest/FileResourceTestBase.php, line 109

Class

FileResourceTestBase

Namespace

Drupal\Tests\file\Functional\Rest

Code

protected function getExpectedNormalizedEntity() {
    return [
        'changed' => [
            $this->formatExpectedTimestampItemValues($this->entity
                ->getChangedTime()),
        ],
        'created' => [
            $this->formatExpectedTimestampItemValues((int) $this->entity
                ->getCreatedTime()),
        ],
        '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(),
            ],
        ],
    ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.