The \Drupal\field\Tests\TranslationTest::testFieldAvailableLanguages is still use the old field_name property of the field entity.
This cause a Undefined property: Drupal\field\Entity\Field::$field_name notice error, but therefore the while test is irrelevant, because the name of the field is not changed.

There is another bug with the length of the field name, because the field name become longer than the maximum 32 character when it gets the "_untranslatable" suffix.

And this test is still using the deprecated functions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sweetchuck’s picture

Sweetchuck’s picture

Status: Needs work » Needs review
chx’s picture

Assigned: Unassigned » yched
Status: Needs review » Reviewed & tested by the community

This is correct but I have no idea why it didn't fail previously so I am assigning this to yched in hope he has some insight. That should not block committing this.

yched’s picture

Indeed, nice catch. Test classes that have seen addition after addition are sorry stacks of crappy code...

Refactored/cleaned a bit more, but reverted the unrelated entity_get_info() / field_info_instances() changes, I'm not in favor of doing those bit by bit in unrelated issues.

Sweetchuck’s picture

OK. RTBC for patch #4

YesCT’s picture

+++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
@@ -137,9 +131,12 @@ function testFieldAvailableLanguages() {
     $this->assertTrue(count($available_langcodes) == 1 && $available_langcodes[0] === Language::LANGCODE_NOT_SPECIFIED, 'For untranslatable fields only Language::LANGCODE_NOT_SPECIFIED is available.');

Is that right? "For untranslatable fields only Language::LANGCODE_NOT_SPECIFIED is available." I thought things could know their language even if they were not translatable.
.

YesCT’s picture

Issue tags: +D8MI

tagging d8mi as it is related to translation

YesCT’s picture

+++ b/core/modules/field/lib/Drupal/field/Tests/TranslationTest.php
@@ -149,7 +152,7 @@ function testFieldAvailableLanguages() {
-    $entity_info = entity_get_info('node');
+    $entity_info = \Drupal::entityManager()->getDefinition('node');

@@ -257,7 +260,7 @@ function testFieldDisplayLanguage() {
-    $instances = field_info_instances($entity_type, $bundle);
+    $instances = \Drupal\field\Field::fieldInfo()->getBundleInstances($entity_type, $bundle);

it makes sense to not do these changes bit by bit. but which issue is doing them? let's link to it.

Xano’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: field_translation_test-2125497-4.patch, failed testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: field_translation_test-2125497-4.patch, failed testing.

yched’s picture

Status: Needs work » Needs review
FileSize
2.87 KB

Reroll

@YesCT

"For untranslatable fields only Language::LANGCODE_NOT_SPECIFIED is available." I thought things could know their language even if they were not translatable

Yes, in the new Entity/Field API, but this is still testing the "old" field_language_*() API, that behaves a little differently. This API is being deprecated, but there are still a couple blocker issues, for now it's still here along with the corresponding tests.

areke’s picture

FileSize
3.24 KB

The patch didn't apply anymore, so I re-rolled it.

Status: Needs review » Needs work

The last submitted patch, 14: 2125497-14.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review

14: 2125497-14.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 14: 2125497-14.patch, failed testing.

Sweetchuck’s picture

yched’s picture

Status: Needs work » Needs review
yched’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC...

webchick’s picture

Status: Reviewed & tested by the community » Needs work

No longer applies, presumably because we just removed the old translation API.

One more time! :)

yched’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
1.49 KB

Heh :-)

In the end, there's actually not much left to fix here now, the faulty test has been removed along with the old translation API.
What's left from the patch are just minor streamline / cleanups with no functional impact.

Reuploading it, and setting back to RTBC (since what's left has been RTBCed before), but this doesn't really match the issue title & category anymore.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 22: field-trans-old-field-name-2125497-22.patch, failed testing.

Berdir’s picture

Status: Needs work » Needs review
Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Random test fail.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.