Skip to content
Snippets Groups Projects

Conversion.

1 unresolved thread

Closes #3414625

Merge request reports

Members who can merge are allowed to add commits.
Code Quality is loading
Test summary results are being parsed
Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
43 39 * The event object.
44 40 */
45 41 public function onKernelTerminate(TerminateEvent $event) {
46 foreach ($this->services as $id) {
47 // Check if the service was initialized during this request, destruction
48 // is not necessary if the service was not used.
49 if ($this->container->initialized($id)) {
50 $service = $this->container->get($id);
42 foreach ($this->services as $service) {
  • configurators are neat way to track initialised on a per request basis.

    do we have existing coverage to ensure that services not initialised [during a request] do not get called by this method? formerly, the initialized gate.

    we should add coverage to ensure the configurator in particular is, and is not, registered.

    random q, is there any need to de-register the autoconfigurators in the same request? or will container reset/rebuilt do all we need

  • Author Maintainer

    \Drupal\KernelTests\Core\DrupalKernel\ServiceDestructionTest claims to cover both cases, I haven't looked at it in detail or tried to break it, but it does still pass here.

    We could perhaps add coverage to spy into the $services property and check that the services are correctly registered as well.

    Not really sure about de-registration, is there a case where the kernel is destructed twice? Maybe we should forget each service after we have called destruct()? But that seems more dangerous as I don't think the configurator will be called a second time.

    Edited by Dave Long
  • Please register or sign in to reply
  • added 1 commit

    • 579998f4 - Fixed the service destructor

    Compare with previous version

  • added 1 commit

    • 82535912 - Fixed the service destructor+1

    Compare with previous version

  • Please register or sign in to reply
    Loading