Problem/Motivation

https://git.drupalcode.org/project/quicktabs/-/jobs/8919549

1 test triggered 2 deprecations:

1) /builds/project/quicktabs/vendor/symfony/deprecation-contracts/function.php:25
The "cache.backend.memory" service is deprecated in drupal:11.3.0 and is removed from drupal:13.0.0. Use cache.backend.memory.memory instead. See https://www.drupal.org/node/3546856

Triggered by:

* Drupal\Tests\quicktabs\Kernel\QuickTabsTitleRenderTest::testTabTitleIsEscapedOnlyOnce
/builds/project/quicktabs/tests/src/Kernel/QuickTabsTitleRenderTest.php:34

2) /builds/project/quicktabs/web/core/lib/Drupal/Core/Plugin/Discovery/AttributeDiscoveryWithAnnotations.php:98
Using @EntityType annotation for plugin with ID quicktabs_instance is deprecated and is removed from drupal:13.0.0. Use a Drupal\Core\Entity\Attribute\EntityType attribute instead. See https://www.drupal.org/node/3395575

Triggered by:

* Drupal\Tests\quicktabs\Kernel\QuickTabsTitleRenderTest::testTabTitleIsEscapedOnlyOnce
/builds/project/quicktabs/tests/src/Kernel/QuickTabsTitleRenderTest.php:34

FAILURES!
Tests: 1, Assertions: 1, Failures: 1, Deprecations: 2.

CI is failing due to two deprecations introduced in Drupal 11.3. These are triggered during the QuickTabsTitleRenderTest kernel test.

  1. The cache.backend.memory service is deprecated and will be removed in Drupal 13. It should be replaced with cache.backend.memory.memory.Needs 11.3
  2. The @EntityType annotation used for the quicktabs_instance plugin is deprecated. Drupal now expects entity types to be defined using the Drupal\Core\Entity\Attribute\EntityType PHP attribute.

Both deprecations cause the test suite to fail because deprecations are treated as failures in CI.

Steps to reproduce

  1. Run the test suite on Drupal 11.3 or later.
  2. Execute the kernel tests.

Example:

phpunit tests/src/Kernel/QuickTabsTitleRenderTest.php

Result:

Two deprecations are triggered and CI fails.

Proposed resolution

  1. Replace usage of the deprecated cache.backend.memory service with cache.backend.memory.memory.</li>
  2. Convert the quicktabs_instance entity definition from the deprecated @EntityType annotation to the Drupal\Core\Entity\Attribute\EntityType attribute.

This will remove the deprecations and restore compatibility with Drupal 11.3+.

Remaining tasks

  1. Replace deprecated cache.backend.memory service usage.
  2. Convert @EntityType annotation to the new attribute syntax.
  3. Run the test suite to confirm the deprecations are resolved.
  4. Ensure compatibility with supported Drupal core versions.

API changes

Entity type definitions will move from annotation-based discovery to PHP attribute-based discovery.

Issue fork quicktabs-3579240

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

joelpittet created an issue. See original summary.

joelpittet’s picture

Title: Fix Drupal 11.3 deprecations: cache.backend.memory service and @EntityType annotation » Fix Drupal 11.3 deprecation @EntityType annotation
Issue summary: View changes

We've got the annotations in og module and PHP attributes which should help a bit. The memory backend is likely not going to change here as it needs a minimum 11.3. So I will shrink the scope here.

joelpittet’s picture

Status: Active » Needs review

  • joelpittet committed 24130a35 on 4.0.x
    task: #3579240 Fix Drupal 11.3 deprecation @EntityType annotation
    
    By:...

  • joelpittet committed cb80a3f7 on 4.0.x
    task: #3579240 Use class constants for plugin interface references
    
joelpittet’s picture

Status: Needs review » Fixed

Merged this in

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.

Status: Fixed » Closed (fixed)

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