function ConfigurableLanguageTest::testGetIndividualDefaultConfig

Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php \Drupal\Tests\jsonapi\Functional\ConfigurableLanguageTest::testGetIndividualDefaultConfig()
  2. 10 core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php \Drupal\Tests\jsonapi\Functional\ConfigurableLanguageTest::testGetIndividualDefaultConfig()
  3. 11.x core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php \Drupal\Tests\jsonapi\Functional\ConfigurableLanguageTest::testGetIndividualDefaultConfig()

Test a GET request for a default config entity, which has a _core key.

See also

https://www.drupal.org/project/drupal/issues/2915539

File

core/modules/jsonapi/tests/src/Functional/ConfigurableLanguageTest.php, line 122

Class

ConfigurableLanguageTest
JSON:API integration test for the "ConfigurableLanguage" config entity type.

Namespace

Drupal\Tests\jsonapi\Functional

Code

public function testGetIndividualDefaultConfig() {
    // @todo Remove line below in favor of commented line in https://www.drupal.org/project/drupal/issues/2878463.
    $url = Url::fromRoute('jsonapi.configurable_language--configurable_language.individual', [
        'entity' => ConfigurableLanguage::load('en')->uuid(),
    ]);
    
    /* $url = ConfigurableLanguage::load('en')->toUrl('jsonapi'); */
    $request_options = [];
    $request_options[RequestOptions::HEADERS]['Accept'] = 'application/vnd.api+json';
    $request_options = NestedArray::mergeDeep($request_options, $this->getAuthenticationRequestOptions());
    $this->setUpAuthorization('GET');
    $response = $this->request('GET', $url, $request_options);
    $normalization = Json::decode((string) $response->getBody());
    $this->assertArrayNotHasKey('_core', $normalization['data']['attributes']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.