Problem/Motivation

.module files are only necessary when there are preprocess functions now that almost all hooks can be OOP

Steps to reproduce

Open file

Proposed resolution

  • deprecate entity_test_create_bundle(), create alternative at EntityTestHelper class.
  • deprecate entity_test_delete_bundle(), create alternative at EntityTestHelper class.
  • add Change Record

Remaining tasks

None

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

CommentFileSizeAuthor
#23 3495966-nr-bot.txt91 bytesneeds-review-queue-bot

Issue fork drupal-3495966

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

nikolay shapovalov created an issue. See original summary.

nikolay shapovalov’s picture

Assigned: nikolay shapovalov » Unassigned
Status: Needs work » Needs review
smustgrave’s picture

This one I actually have some concern on. Clearly it's used throughout core so probably a fair assumption it could be in contrib. So this would immediately break people's tests.

nikolay shapovalov’s picture

Do you have any suggestion?
Adding deprecation message, means that we still need to have this hook in the code base.
Maybe we can add rector rule for that?

smustgrave’s picture

Status: Needs review » Needs work

Brought this up in #core-development and @larowlan agreed this probably needs to be deprecated as there are lot of usages in contrib

https://git.drupalcode.org/search?group_id=2&scope=blobs&search=%22entit...

nicxvan’s picture

It's not a hook, it's just a function, we can follow normal deprecation rules here and add the deprecation message to the function.

You can look at this MR for examples: https://git.drupalcode.org/project/drupal/-/merge_requests/10309/diffs

And this documentation https://www.drupal.org/about/core/policies/core-change-policies/how-to-d...
If you've not done it before the message has a specific structure so copying and updating is most likely the easiest way forward.

You'll also need a CR for the message so you'll want to create one before doing that so you have the link.

Let me know if you have any other questions, it's unfortunate that this one is trickier than the other conversions, but it's used a lot so this makes sense.

Deprecations are the most common way to do this, we've only been able to skip that for these conversions because they are test modules.

Technically in this case we don't have to deprecate because tests are not api and don't need deprecation, but since this used by a ton of contrib we make an exception and deprecate in order to notify contrib and custom code they need to update.

You can open an issue in https://www.drupal.org/project/rector to create a rule for this, but that will still require the deprecation.
If you don't want to do this I can take this one back on, let me know!

berdir’s picture

Agreed, entity_test is a widely used test module as it is enabled by default with \Drupal\KernelTests\Core\Entity\EntityKernelTestBase, so IMHO that basically makes it an API for tests, which is also covered by BC.

nikolay shapovalov’s picture

Thanks @smustgrave for your effort. Thanks @berdir for the feedback.
Thanks @nicxvan for explanation, I create CR #3497049, but not sure about version 11.1.x or 11.2.x.

smustgrave’s picture

Would be deprecated in 11.2 removed in 12

smustgrave’s picture

Since 11.1 is already out

nikolay shapovalov’s picture

Issue summary: View changes
Status: Needs work » Needs review

Thanks.
I return back entity_test_create_bundle() to entity_test.module.
Add deprecation message.
Revert change to .phpstand-baseline.php.
And rebased branch on recent 11.x.
MR is ready for review.

It looks like issue title needs to be update:
What about: "Deprecated and replace entity_test_create_bundle()"?

smustgrave’s picture

That’s a fine title.

nikolay shapovalov’s picture

Title: Move entity_test_create_bundle from entity_test.module » Deprecated and replace entity_test_create_bundle()

Update issue title.

nikolay shapovalov’s picture

Title: Deprecated and replace entity_test_create_bundle() » Deprecate and replace entity_test_create_bundle()
nikolay shapovalov’s picture

Title: Deprecate and replace entity_test_create_bundle() » Deprecate and replace entity_test_create_bundle(), entity_test_delete_bundle()
Issue summary: View changes

Update title and IS.

nikolay shapovalov’s picture

Status: Needs review » Needs work

@berdir thanks for feedback, set to NW.

nikolay shapovalov’s picture

Issue summary: View changes
nikolay shapovalov’s picture

Status: Needs work » Needs review

Replaced entity_test_delete_bundle() and added @see links to EntityTestHooks::entityBundleInfo() as @berdir suggested.
CR draft updated. MR is ready for review.

nicxvan’s picture

Status: Needs review » Needs work

I went through everything, looks great two suggestions that need to be applied.

CR looks great short and to the point.

I can rtbc once the suggestions are applied.

nikolay shapovalov’s picture

Status: Needs work » Needs review

Thanks @nicxvan, changes applied. Ready for review.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me now.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. 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.

nicxvan’s picture

Status: Needs work » Needs review

This one had a couple of conflicts, rebased though should be ready for review.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Rebase looks good to me, properly merged with the now existing EntityTestHelper class.

nikolay shapovalov’s picture

LGTM. +1 for RTBC.

ironnuts’s picture

#7 mentions deprecation messages. Reading the comments I am not sure if it was decided they would not be required? I do not see any such messages in the MR: see 'Proposed resolution' in the issue summary.

nicxvan’s picture

ironnuts’s picture

@nicxvan Thanks. Great. I was scrolling forever through the code : )

nikolay shapovalov’s picture

Issue summary: View changes

Update IS.

  • catch committed 78bebf2b on 11.x
    Issue #3495966 by nikolay shapovalov, nicxvan, smustgrave, berdir:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x, thanks!

nicxvan’s picture

Status: Fixed » Closed (fixed)

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