diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 38005dc..27d130f 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -534,7 +534,7 @@ public function getFields($include_computed = TRUE) { * {@inheritdoc} */ public function getTranslatableFields($include_computed = TRUE) { - $fields = array(); + $fields = []; foreach ($this->getFieldDefinitions() as $name => $definition) { if (($include_computed || !$definition->isComputed()) && $definition->isTranslatable()) { $fields[$name] = $this->get($name); diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 7c4aa07..27dccd8 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -421,7 +421,6 @@ protected function invokeFieldMethod($method, ContentEntityInterface $entity) { $result[$langcode][$name] = $args ? call_user_func_array([$items, $method], $args) : $items->{$method}(); } } - } return $result; } diff --git a/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php b/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php index 7f7a0a7..da70c2f 100644 --- a/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php +++ b/core/modules/system/src/Tests/Entity/ContentEntityCloneTest.php @@ -2,13 +2,13 @@ /** * @file - * Contains Drupal\system\Tests\Entity\ContentEntityCloneTest. + * Contains \Drupal\system\Tests\Entity\ContentEntityCloneTest. */ namespace Drupal\system\Tests\Entity; -use Drupal\language\Entity\ConfigurableLanguage; use Drupal\entity_test\Entity\EntityTestMul; +use Drupal\language\Entity\ConfigurableLanguage; /** * Tests proper cloning of content entities. @@ -18,14 +18,12 @@ class ContentEntityCloneTest extends EntityUnitTestBase { /** - * Modules to enable. - * - * @var array + * {@inheritdoc} */ public static $modules = ['language', 'entity_test']; /** - * @inheritdoc + * {@inheritdoc} */ protected function setUp() { parent::setUp(); @@ -37,7 +35,7 @@ protected function setUp() { } /** - * Tests correct entity reference on fields after clone. + * Tests if entity references on fields are still correct after cloning. */ public function testFieldEntityReferenceAfterClone() { $user = $this->createUser(); @@ -58,14 +56,15 @@ public function testFieldEntityReferenceAfterClone() { $translation = $clone->getTranslation($langcode); foreach ($translation->getFields() as $field_name => $field) { if ($field->getFieldDefinition()->isTranslatable()) { - $this->assertEqual($langcode, $field->getEntity()->language()->getId(), format_string('Translatable field %field_name on translation %langcode has correct entity reference in translation %langcode after cloning.', - array('%field_name' => $field_name, '%langcode' => $langcode))); + $args = ['%field_name' => $field_name, '%langcode' => $langcode]; + $this->assertEqual($langcode, $field->getEntity()->language()->getId(), format_string('Translatable field %field_name on translation %langcode has correct entity reference in translation %langcode after cloning.', $args)); } else { - $this->assertEqual($default_langcode, $field->getEntity()->language()->getId(), format_string('Non translatable field %field_name on translation %langcode has correct entity reference in the default translation %default_langcode after cloning.', - array('%field_name' => $field_name, '%langcode' => $langcode, '%default_langcode' => $default_langcode))); + $args = ['%field_name' => $field_name, '%langcode' => $langcode, '%default_langcode' => $default_langcode]; + $this->assertEqual($default_langcode, $field->getEntity()->language()->getId(), format_string('Non translatable field %field_name on translation %langcode has correct entity reference in the default translation %default_langcode after cloning.', $args)); } } } } + } diff --git a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php index 9afdfa5..21ff392 100644 --- a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php @@ -770,7 +770,7 @@ function testEntityAdapter() { } /** - * Tests correct entity reference on fields after adding new translation. + * Tests if entity references are correct after adding a new translation. */ public function testFieldEntityReference() { $entity_type = 'entity_test_mul'; @@ -787,14 +787,15 @@ public function testFieldEntityReference() { $translation = $entity->getTranslation($langcode); foreach ($translation->getFields() as $field_name => $field) { if ($field->getFieldDefinition()->isTranslatable()) { - $this->assertEqual($langcode, $field->getEntity()->language()->getId(), format_string('Translatable field %field_name on translation %langcode has correct entity reference in translation %langcode.', - array('%field_name' => $field_name, '%langcode' => $langcode))); + $args = ['%field_name' => $field_name, '%langcode' => $langcode]; + $this->assertEqual($langcode, $field->getEntity()->language()->getId(), format_string('Translatable field %field_name on translation %langcode has correct entity reference in translation %langcode.', $args)); } else { - $this->assertEqual($default_langcode, $field->getEntity()->language()->getId(), format_string('Non translatable field %field_name on translation %langcode has correct entity reference in the default translation %default_langcode.', - array('%field_name' => $field_name, '%langcode' => $langcode, '%default_langcode' => $default_langcode))); + $args = ['%field_name' => $field_name, '%langcode' => $langcode, '%default_langcode' => $default_langcode]; + $this->assertEqual($default_langcode, $field->getEntity()->language()->getId(), format_string('Non translatable field %field_name on translation %langcode has correct entity reference in the default translation %default_langcode.', $args)); } } } } + }