function CommentResourceTestBase::getExpectedNormalizedEntity
Same name in other branches
- 8.9.x core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getExpectedNormalizedEntity()
- 10 core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getExpectedNormalizedEntity()
- 11.x core/modules/comment/tests/src/Functional/Rest/CommentResourceTestBase.php \Drupal\Tests\comment\Functional\Rest\CommentResourceTestBase::getExpectedNormalizedEntity()
Overrides EntityResourceTestBase::getExpectedNormalizedEntity
1 call to CommentResourceTestBase::getExpectedNormalizedEntity()
- CommentHalJsonTestBase::getExpectedNormalizedEntity in core/
modules/ hal/ tests/ src/ Functional/ comment/ CommentHalJsonTestBase.php - Returns the expected normalization of the entity.
1 method overrides CommentResourceTestBase::getExpectedNormalizedEntity()
- CommentHalJsonTestBase::getExpectedNormalizedEntity in core/
modules/ hal/ tests/ src/ Functional/ comment/ CommentHalJsonTestBase.php - Returns the expected normalization of the entity.
File
-
core/
modules/ comment/ tests/ src/ Functional/ Rest/ CommentResourceTestBase.php, line 123
Class
Namespace
Drupal\Tests\comment\Functional\RestCode
protected function getExpectedNormalizedEntity() {
$author = User::load($this->entity
->getOwnerId());
return [
'cid' => [
[
'value' => 1,
],
],
'uuid' => [
[
'value' => $this->entity
->uuid(),
],
],
'langcode' => [
[
'value' => 'en',
],
],
'comment_type' => [
[
'target_id' => 'comment',
'target_type' => 'comment_type',
'target_uuid' => CommentType::load('comment')->uuid(),
],
],
'subject' => [
[
'value' => 'Llama',
],
],
'status' => [
[
'value' => TRUE,
],
],
'created' => [
[
'value' => (new \DateTime())->setTimestamp(123456789)
->setTimezone(new \DateTimeZone('UTC'))
->format(\DateTime::RFC3339),
'format' => \DateTime::RFC3339,
],
],
'changed' => [
[
'value' => (new \DateTime())->setTimestamp((int) $this->entity
->getChangedTime())
->setTimezone(new \DateTimeZone('UTC'))
->format(\DateTime::RFC3339),
'format' => \DateTime::RFC3339,
],
],
'default_langcode' => [
[
'value' => TRUE,
],
],
'uid' => [
[
'target_id' => (int) $author->id(),
'target_type' => 'user',
'target_uuid' => $author->uuid(),
'url' => base_path() . 'user/' . $author->id(),
],
],
'pid' => [],
'entity_type' => [
[
'value' => 'entity_test',
],
],
'entity_id' => [
[
'target_id' => 1,
'target_type' => 'entity_test',
'target_uuid' => EntityTest::load(1)->uuid(),
'url' => base_path() . 'entity_test/1',
],
],
'field_name' => [
[
'value' => 'comment',
],
],
'name' => [],
'homepage' => [],
'thread' => [
[
'value' => '01/',
],
],
'comment_body' => [
[
'value' => 'The name "llama" was adopted by European settlers from native Peruvians.',
'format' => 'plain_text',
'processed' => '<p>The name "llama" was adopted by European settlers from native Peruvians.</p>' . "\n",
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.