Problem/Motivation

As outlined in #2430673: ContentEntityBase::__construct() lacks documentation there is some uncertainty over whether ContentEntityBase([LANGUAGE_DEFAULT => , 'fr' => ]) would even work. And even if it does, it would definitely be a good idea to get this tested. Especially since the $values data structure is very ... interesting so a proven to be working example is very useful here.

Steps to reproduce

Proposed resolution

Create a test called on `core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php` called `testEntityConstructor` to test the ability to call ContentEntityBase contructor with several langcodes.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-2436209

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dawehner’s picture

chx’s picture

Opsie, sorry, thanks for fixing it, too many browser tabs :)

chx’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

Here we are.

chx’s picture

Issue summary: View changes
StatusFileSize
new1.45 KB

Moved the count assert one line down.

berdir’s picture

Status: Needs review » Needs work

As discussed with @chx, one goal here is essentially to provide examples/code documentation for alternative storage backends. Maybe we could actually refer to this somewhere, e.g. on the content entity storage base class?

The test currently doesn't pass in $bundle and $translations to the constructor.

1. The missing bundle only works because entity_test by default has no bundles and uses the $bundle == $entity_type_id fallback. We should instead (or maybe additionally) create a random bundle with entity_test_create_bundle(), including a test field that only exists on that bundle and create values also for that configurable field.

2. Missing $translations can probably be tested by calling getTranslationLanguages(), it should return the same languages as you create.

I think doing those two things should give you fairly good test coverage of those arguments.

Also wondering if we shouldn't merge this back together with #2430673: ContentEntityBase::__construct() lacks documentation. I wouldn't be surprised if this issue would get pushed back due to missing documentation.

chx’s picture

Status: Needs work » Needs review
StatusFileSize
new2.46 KB
plach’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me, let's try to RTBC this and see what happens ;)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 6: 2436209_6.patch, failed testing.

chx’s picture

Issue tags: +Needs reroll
siva_epari’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new2.47 KB

Patch rerolled.

plach’s picture

Status: Needs review » Reviewed & tested by the community

Thanks

xjm’s picture

Assigned: chx » Unassigned
Status: Reviewed & tested by the community » Needs work

A couple inline comments in this test would be peachy; it's kind of a wall of code at the moment, so somewhat difficult to see exactly what it tests. ("Works with translations" is not specific.)

I can see the case for separating the scope from #2430673: ContentEntityBase::__construct() lacks documentation or for combining the patches; no strong feelings either way.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

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

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

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

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

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

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

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

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

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

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

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

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

Drupal 8.6.x will not receive any further development aside from security fixes. 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.

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

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.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.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for creating this issue to improve Drupal.

We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Needs work
Issue tags: +Needs issue summary update, +Novice

Actually seems to still be relevant.

Tagging for novice for a reroll and issue summary update. Both a new user should be able to achieve.

Thanks all

nexusnovaz made their first commit to this issue’s fork.

luismagr made their first commit to this issue’s fork.

luismagr’s picture

Status: Needs work » Needs review

I think I've re rolled the patch correctly, but I had to modify certain code that has been deprecated during these years.

Please, have a look to it and review if something else is missing.

Thanks

needs-review-queue-bot’s picture

Status: Needs review » Needs work
StatusFileSize
new1.26 KB

The Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

luismagr’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Still appears to need an IS update please.

luismagr’s picture

Issue summary: View changes
luismagr’s picture

Status: Needs work » Needs review

Thanks @smustgrave. I updated the issue summary. However, I'm not sure if I'm missing something for the description.

Again, thanks for the time.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs issue summary update

Believe this one is ready to go.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

  • catch committed 4a97f88d on 11.3.x
    task: #2436209 Test ContentEntityBase constructor called with...

  • catch committed ce8edf6f on 11.x
    task: #2436209 Test ContentEntityBase constructor called with...

Status: Fixed » Closed (fixed)

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