Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / modules / rest / tests / src / Functional / EntityResource / ConfigurableLanguage / ConfigurableLanguageResourceTestBase.php
index 301beb2f06832dc17034b5c15ff8544742ea9aba..cf5be74737bd83a0808622407993a05567174757 100644 (file)
@@ -3,6 +3,7 @@
 namespace Drupal\Tests\rest\Functional\EntityResource\ConfigurableLanguage;
 
 use Drupal\Core\Cache\Cache;
+use Drupal\Core\Url;
 use Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase;
 use Drupal\language\Entity\ConfigurableLanguage;
 
@@ -74,4 +75,21 @@ abstract class ConfigurableLanguageResourceTestBase extends EntityResourceTestBa
     // @todo Update in https://www.drupal.org/node/2300677.
   }
 
+  /**
+   * Test a GET request for a default config entity, which has a _core key.
+   *
+   * @see https://www.drupal.org/node/2915414
+   */
+  public function testGetDefaultConfig() {
+    $this->initAuthentication();
+    $url = Url::fromUri('base:/entity/configurable_language/en')->setOption('query', ['_format' => static::$format]);;
+    $request_options = $this->getAuthenticationRequestOptions('GET');
+    $this->provisionEntityResource();
+    $this->setUpAuthorization('GET');
+    $response = $this->request('GET', $url, $request_options);
+
+    $normalization = $this->serializer->decode((string) $response->getBody(), static::$format);
+    $this->assertArrayNotHasKey('_core', $normalization);
+  }
+
 }