diff -u b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php --- b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php +++ b/core/modules/hal/lib/Drupal/hal/Normalizer/EntityNormalizer.php @@ -73,10 +73,8 @@ throw new UnexpectedValueException('The type link relation must be specified.'); } - // Get language. language_default() is used because otherwise the entity - // system cannot understand the langcode when working in the DrupalUnitTest - // environment and importing data without an explicit langcode. - $langcode = isset($data['langcode']) ? $data['langcode'][0]['value'] : language_default(); + // Get language. + $langcode = isset($data['langcode']) ? $data['langcode'][0]['value'] : LANGUAGE_NOT_SPECIFIED; // Create the entity. $typed_data_ids = $this->getTypedDataIds($data['_links']['type']); diff -u b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php --- b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php +++ b/core/modules/hal/lib/Drupal/hal/Tests/DenormalizeTest.php @@ -136,12 +136,10 @@ array( 'value' => $this->randomName(), 'format' => 'full_html', - 'lang' => 'en', ), array( 'value' => $this->randomName(), 'format' => 'filtered_html', - 'lang' => 'en', ), array( 'value' => $this->randomName(), @@ -156,7 +154,7 @@ ), ); - $expected_value_en = array( + $expected_value_default = array( array ( 'value' => $data['field_test_translatable_text'][0]['value'], 'format' => 'full_html', @@ -179,7 +177,7 @@ $denormalized = $this->serializer->denormalize($data, $this->entityClass, $this->format); $this->assertEqual($data['uuid'], $denormalized->get('uuid')->getValue(), 'A preset value (e.g. UUID) is overridden by incoming data.'); $this->assertEqual($data['field_test_text'], $denormalized->get('field_test_text')->getValue(), 'A basic text field is denormalized.'); - $this->assertEqual($expected_value_en, $denormalized->get('field_test_translatable_text')->getValue(), 'Values in the default language are properly handled for a translatable field.'); + $this->assertEqual($expected_value_default, $denormalized->get('field_test_translatable_text')->getValue(), 'Values in the default language are properly handled for a translatable field.'); $this->assertEqual($expected_value_de, $denormalized->getTranslation('de')->get('field_test_translatable_text')->getValue(), 'Values in a translation language are properly handled for a translatable field.'); } }