class EntityTestComputedFieldNormalizerTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestComputedFieldNormalizerTest
- 10 core/modules/system/tests/modules/entity_test/tests/src/Functional/Rest/EntityTestComputedFieldNormalizerTest.php \Drupal\Tests\entity_test\Functional\Rest\EntityTestComputedFieldNormalizerTest
Test normalization of computed field.
@group rest
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\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait 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\rest\Functional\EntityResource\ConfigEntityResourceTestBase extends \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase uses \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait extends \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Rest\EntityTestComputedFieldNormalizerTest uses \Drupal\Tests\rest\Functional\AnonResourceTestTrait extends \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase
- class \Drupal\Tests\entity_test\Functional\Rest\EntityTestResourceTestBase uses \Drupal\Tests\system\Functional\Entity\Traits\EntityDefinitionTestTrait extends \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase
- class \Drupal\Tests\rest\Functional\EntityResource\ConfigEntityResourceTestBase 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 EntityTestComputedFieldNormalizerTest
File
-
core/
modules/ system/ tests/ modules/ entity_test/ tests/ src/ Functional/ Rest/ EntityTestComputedFieldNormalizerTest.php, line 13
Namespace
Drupal\Tests\entity_test\Functional\RestView source
class EntityTestComputedFieldNormalizerTest extends EntityTestResourceTestBase {
use AnonResourceTestTrait;
/**
* {@inheritdoc}
*/
protected static $entityTypeId = 'entity_test_computed_field';
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUpAuthorization($method) {
$this->grantPermissionsToTestedRole([
'administer entity_test content',
]);
}
/**
* {@inheritdoc}
*/
protected function getExpectedUnauthorizedAccessMessage($method) {
if ($this->config('rest.settings')
->get('bc_entity_resource_permissions')) {
return parent::getExpectedUnauthorizedAccessMessage($method);
}
return "The 'administer entity_test content' permission is required.";
}
/**
* {@inheritdoc}
*/
protected function getExpectedNormalizedEntity() {
$expected = parent::getExpectedNormalizedEntity();
$expected['computed_reference_field'] = [];
$expected['computed_string_field'] = [];
unset($expected['field_test_text'], $expected['langcode'], $expected['type'], $expected['uuid']);
// @see \Drupal\entity_test\Plugin\Field\ComputedTestCacheableStringItemList::computeValue().
$expected['computed_test_cacheable_string_field'] = [
[
'value' => 'computed test cacheable string field',
],
];
$expected['uuid'] = [
0 => [
'value' => $this->entity
->uuid(),
],
];
return $expected;
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheContexts() {
return Cache::mergeContexts(parent::getExpectedCacheContexts(), [
'url.query_args:computed_test_cacheable_string_field',
]);
}
/**
* {@inheritdoc}
*/
protected function getExpectedCacheTags() {
return Cache::mergeTags(parent::getExpectedCacheTags(), [
'field:computed_test_cacheable_string_field',
]);
}
/**
* {@inheritdoc}
*/
public function testPost() {
// Post test not required.
$this->markTestSkipped();
}
/**
* {@inheritdoc}
*/
public function testPatch() {
// Patch test not required.
$this->markTestSkipped();
}
/**
* {@inheritdoc}
*/
public function testDelete() {
// Delete test not required.
$this->markTestSkipped();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.