class EntityTestLabelHalJsonAnonTest
Same name and namespace in other branches
- 9 core/modules/hal/tests/src/Functional/entity_test/EntityTestLabelHalJsonAnonTest.php \Drupal\Tests\hal\Functional\entity_test\EntityTestLabelHalJsonAnonTest
@group hal
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\PhpunitCompatibilityTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\rest\Functional\ResourceTestBase extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase extends \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Rest\EntityTestLabelResourceTestBase uses \Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait extends \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Hal\EntityTestLabelHalJsonAnonTest uses \Drupal\Tests\hal\Functional\EntityResource\HalEntityNormalizationTrait, \Drupal\Tests\rest\Functional\AnonResourceTestTrait extends \Drupal\Tests\entity_test\Functional\Rest\EntityTestLabelResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Rest\EntityTestLabelResourceTestBase uses \Drupal\Tests\rest\Functional\BcTimestampNormalizerUnixTestTrait extends \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase extends \Drupal\Tests\rest\Functional\ResourceTestBase
- class \Drupal\Tests\rest\Functional\ResourceTestBase extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of EntityTestLabelHalJsonAnonTest
File
-
core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Hal/ EntityTestLabelHalJsonAnonTest.php, line 13
Namespace
Drupal\Tests\entity_test\Functional\HalView source
class EntityTestLabelHalJsonAnonTest extends EntityTestLabelResourceTestBase {
use HalEntityNormalizationTrait;
use AnonResourceTestTrait;
/**
* {@inheritdoc}
*/
public static $modules = [
'hal',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $format = 'hal_json';
/**
* {@inheritdoc}
*/
protected static $mimeType = 'application/hal+json';
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
$default_normalization = parent::getExpectedNormalizedEntity();
$normalization = $this->applyHalFieldNormalization($default_normalization);
$author = User::load(0);
return $normalization + [
'_links' => [
'self' => [
'href' => $this->baseUrl . '/entity/entity_test_label/1?_format=hal_json',
],
'type' => [
'href' => $this->baseUrl . '/rest/type/entity_test_label/entity_test_label',
],
$this->baseUrl . '/rest/relation/entity_test_label/entity_test_label/user_id' => [
[
'href' => $this->baseUrl . '/user/0?_format=hal_json',
'lang' => 'en',
],
],
],
'_embedded' => [
$this->baseUrl . '/rest/relation/entity_test_label/entity_test_label/user_id' => [
[
'_links' => [
'self' => [
'href' => $this->baseUrl . '/user/0?_format=hal_json',
],
'type' => [
'href' => $this->baseUrl . '/rest/type/user/user',
],
],
'uuid' => [
[
'value' => $author->uuid(),
],
],
'lang' => 'en',
],
],
],
];
}
/**
* {@inheritdoc}
*/
protected function getNormalizedPostEntity() {
return parent::getNormalizedPostEntity() + [
'_links' => [
'type' => [
'href' => $this->baseUrl . '/rest/type/entity_test_label/entity_test_label',
],
],
];
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return [
'url.site',
'user.permissions',
];
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
EntityTestLabelHalJsonAnonTest::$defaultTheme | protected | property | |
EntityTestLabelHalJsonAnonTest::$format | protected static | property | |
EntityTestLabelHalJsonAnonTest::$mimeType | protected static | property | |
EntityTestLabelHalJsonAnonTest::$modules | public static | property | |
EntityTestLabelHalJsonAnonTest::getExpectedCacheContexts | protected | function | |
EntityTestLabelHalJsonAnonTest::getExpectedNormalizedEntity | protected | function | |
EntityTestLabelHalJsonAnonTest::getNormalizedPostEntity | protected | function |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.