You are here

protected function CommentResourceTestBase::getNormalizedPostEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getNormalizedPostEntity()
  2. 10 core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getNormalizedPostEntity()

Returns the normalized POST entity.

Return value

array

Overrides EntityResourceTestBase::getNormalizedPostEntity

See also

::testPost

4 calls to CommentResourceTestBase::getNormalizedPostEntity()
CommentHalJsonTestBase::getNormalizedPostEntity in core/modules/comment/tests/src/Functional/Hal/CommentHalJsonTestBase.php
Returns the normalized POST entity.
CommentResourceTestBase::getNormalizedPatchEntity in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
Returns the normalized PATCH entity.
CommentResourceTestBase::testPostDxWithoutCriticalBaseFields in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
Tests POSTing a comment without critical base fields.
CommentResourceTestBase::testPostSkipCommentApproval in core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php
Tests POSTing a comment with and without 'skip comment approval'.
1 method overrides CommentResourceTestBase::getNormalizedPostEntity()
CommentHalJsonTestBase::getNormalizedPostEntity in core/modules/comment/tests/src/Functional/Hal/CommentHalJsonTestBase.php
Returns the normalized POST entity.

File

core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php, line 218

Class

CommentResourceTestBase

Namespace

Drupal\Tests\comment\Functional\Rest

Code

protected function getNormalizedPostEntity() {
  return [
    'comment_type' => [
      [
        'target_id' => 'comment',
      ],
    ],
    'entity_type' => [
      [
        'value' => 'entity_test',
      ],
    ],
    'entity_id' => [
      [
        'target_id' => (int) EntityTest::load(1)
          ->id(),
      ],
    ],
    'field_name' => [
      [
        'value' => 'comment',
      ],
    ],
    'subject' => [
      [
        'value' => 'Dramallama',
      ],
    ],
    'comment_body' => [
      [
        'value' => 'Llamas are awesome.',
        'format' => 'plain_text',
      ],
    ],
  ];
}