Not all fields of an entity have a label, but I still would like to see their id when they appear in the change list.

CommentFileSizeAuthor
#25 interdiff-3055363-13-24.txt19 byteshoanns
#25 3055363-24.patch14.38 KBhoanns
#22 3055363-22.patch14.37 KBhoanns
#20 interdiff-3055363-13-20.txt2.23 KByogeshmpawar
#20 3055363-20.patch5.51 KByogeshmpawar
#13 Drupal-entup_show_field_name-D8.patch6.01 KBhoanns
#9 Drupal-entup_show_field_name-D8.patch6.01 KBhoanns
Drupal-entup_show_field_name-D8.patch2.08 KBhoanns
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

hoanns created an issue. See original summary.

hoanns’s picture

Does it test now or what is happening

hoanns’s picture

Status: Active » Needs review
joachim’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -entity

Looks good to me.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, Drupal-entup_show_field_name-D8.patch, failed testing. View results

hoanns’s picture

Status: Needs work » Reviewed & tested by the community
alexpott’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Needs work

Thanks for filing this bug report and for fixing it. Bug fixing is very valuable. However in order to commit a bug fix we need an automated to test to prove that we've fixed the bug and ensure that we don't break it again in the future. For more information about writing tests in Drupal 8 see the following links:

  1. https://www.drupal.org/docs/8/testing
  2. https://api.drupal.org/api/drupal/core%21core.api.php/group/testing/8.7.x
alexpott’s picture

Issue tags: +Needs tests
hoanns’s picture

Version: 8.7.x-dev » 8.8.x-dev
hoanns’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Needs work » Needs review

Ok test added

hoanns’s picture

Issue tags: -Needs tests
borisson_’s picture

Status: Needs review » Needs work

I found a nitpick, that should be fixed before we can get this in. Overall this looks really good and I think when this small change is done we can mark this RTBC.

+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
@@ -271,6 +271,42 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
+        t('The %field_name field needs to be installed.', ['%field_name' => 'new_base_field']),
...
+        t('The %field_name field needs to be updated.', ['%field_name' => 'new_base_field']),
...
+        t('The %field_name field needs to be uninstalled.', ['%field_name' => 'new_base_field']),

Should be $this->t() instead of the deprecated t().

hoanns’s picture

Status: Needs work » Needs review

I found 0 occurences of $this->t() in the KernelTests, but 67 occurences of t(). So if this is a valid nitpick it should be adressed in a new issue. I just copied the code style from the existing class.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

You are right! In theory this doesn't need to be t because it doesn't the translatability aspect of it.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityDefinitionUpdateTest.php
@@ -271,6 +271,42 @@ public function testBaseFieldCreateUpdateDeleteWithoutData() {
+    $this->addBaseField('string', 'entity_test_update', FALSE, FALSE);
+    $expected = [
+      'entity_test_update' => [
+        t('The %field_name field needs to be installed.', ['%field_name' => 'new_base_field']),
+      ],
+    ];
+    $this->assertEqual($this->entityDefinitionUpdateManager->getChangeSummary(), $expected, 'EntityDefinitionUpdateManager reports the expected change summary.');

Can we change this to...

    $this->addBaseField('string', 'entity_test_update', FALSE, FALSE);
    $changes = $this->entityDefinitionUpdateManager->getChangeSummary();
    $this->assertCount(1, $changes['entity_test_update']);
    $this->assertEquals('The new_base_field field needs to be installed.', strip_tags($changes['entity_test_update'][0]));
  • This doesn't use t()
  • Makes the asserts simple to read
  • Uses the correct assert functions in the correct way (arguments the right way around)
  • Does not have assert messages because the default messages are better.
yogeshmpawar’s picture

Assigned: Unassigned » yogeshmpawar
hoanns’s picture

You are using assertEquals instead of assertEqual, thats why you think the arguments were in the wrong order. Because these 2 methods somehow have a different order of arguments.

yogeshmpawar’s picture

Assigned: yogeshmpawar » Unassigned
Status: Needs work » Needs review
FileSize
5.51 KB
2.23 KB

Agreed with @alexpott & comments addressed in the updated patch. Also, resolved some small nitpicks & added an interdiff.

hoanns’s picture

But you only changed the first occurence of the bad code

hoanns’s picture

Here I removed all the critiqued occurences

hoanns’s picture

Assigned: Unassigned » hoanns

Status: Needs review » Needs work

The last submitted patch, 22: 3055363-22.patch, failed testing. View results

hoanns’s picture

hoanns’s picture

hoanns’s picture

Assigned: hoanns » Unassigned
Status: Needs work » Needs review
hoanns’s picture

Will this ever be added? it's pretty simple

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

I think the latest version of this patch looks good - the remarks made by @alexpott have been resolved, this being a bug-fix it probably still is set to the right version.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.9 was released on November 6 and is the final full bugfix release for the Drupal 8.7.x series. Drupal 8.7.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.8.0 on December 4, 2019. (Drupal 8.8.0-beta1 is available for testing.)

Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

alexpott’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed f66921a662 to 9.0.x and b3b6a681de to 8.9.x. Thanks!

As a bugfix going to talk to other committers about backport to 8.8.x

  • alexpott committed f66921a on 9.0.x
    Issue #3055363 by hoanns, yogeshmpawar, alexpott, borisson_:...

  • alexpott committed b3b6a68 on 8.9.x
    Issue #3055363 by hoanns, yogeshmpawar, alexpott, borisson_:...

  • alexpott committed 5e9f006 on 8.8.x
    Issue #3055363 by hoanns, yogeshmpawar, alexpott, borisson_:...
alexpott’s picture

Status: Patch (to be ported) » Fixed

@catch +1'd the backport

Status: Fixed » Closed (fixed)

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