3 namespace Drupal\Tests\rest\Functional\EntityResource\ContentLanguageSettings;
5 use Drupal\language\Entity\ContentLanguageSettings;
6 use Drupal\node\Entity\NodeType;
7 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
9 abstract class ContentLanguageSettingsResourceTestBase extends EntityResourceTestBase {
14 public static $modules = ['language', 'node'];
19 protected static $entityTypeId = 'language_content_settings';
22 * @var \Drupal\language\ContentLanguageSettingsInterface
29 protected function setUpAuthorization($method) {
30 $this->grantPermissionsToTestedRole(['administer languages']);
36 protected function createEntity() {
37 // Create a "Camelids" node type.
38 $camelids = NodeType::create([
44 $entity = ContentLanguageSettings::create([
45 'target_entity_type_id' => 'node',
46 'target_bundle' => 'camelids',
48 $entity->setDefaultLangcode('site_default')
57 protected function getExpectedNormalizedEntity() {
59 'default_langcode' => 'site_default',
65 'id' => 'node.camelids',
67 'language_alterable' => FALSE,
69 'target_bundle' => 'camelids',
70 'target_entity_type_id' => 'node',
71 'uuid' => $this->entity->uuid(),
78 protected function getNormalizedPostEntity() {
79 // @todo Update in https://www.drupal.org/node/2300677.
85 protected function getExpectedCacheContexts() {
87 'languages:language_interface',