Adjust TransactorHandler-service signature to use TimeInterface

Created on 31 May 2021, almost 4 years ago
Updated 24 April 2025, 3 days ago

Problem/Motivation

In order to write time-dependent tests a module like `datetime_testing` decorates/switches out core's `Time` service. This cause a TypeError on construction of the TransactorHandler.

Steps to reproduce

Enable `datetime_testing` (or alter the container to inject a different implementation of the TimeInterface for the \Drupal::time() service) and execute transaction.

Proposed resolution

Specify interfaces not classes.

Remaining tasks

n/a

User interface changes

n/a

API changes

n/a

Data model changes

n/a

πŸ“Œ Task
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany frega

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ͺπŸ‡ΈSpain manuel.adan 🌌
  • Merge request !10Use TimeInterface instead of Time class β†’ (Merged) created by manuel.adan
  • Pipeline finished with Skipped
    3 days ago
    #481242
  • Pipeline finished with Skipped
    3 days ago
    #481243
  • Pipeline finished with Skipped
    3 days ago
    #481245
  • Pipeline finished with Skipped
    3 days ago
    #481246
  • Pipeline finished with Skipped
    3 days ago
    #481248
  • Pipeline finished with Skipped
    3 days ago
    #481249
  • Pipeline finished with Skipped
    3 days ago
    #481250
  • Pipeline finished with Skipped
    3 days ago
    #481251
  • πŸ‡ͺπŸ‡ΈSpain manuel.adan 🌌

    Patch #2 committed. Use statements order not touched to clearly view the actual changes, it can be addressed elsewhere, e.g. CS related issue.

  • Pipeline finished with Skipped
    3 days ago
    #481257
  • Pipeline finished with Skipped
    3 days ago
    #481259
  • Pipeline finished with Skipped
    3 days ago
    #481261
  • πŸ‡ͺπŸ‡ΈSpain manuel.adan 🌌

    Tests passed on D9, D10 & D11. Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia
      /**
       * The time service.
       *
       * @var \Drupal\Component\Datetime\Time
       */
      protected $timeService;

    This is still wrong.
    Which I pointed out and tried to correct three years ago in #4...

Production build 0.71.5 2024