Problem/Motivation

Follow-up to #1973618: DIC: Lazy instantiation of service dependencies (ProxyManager for "proxy services"). The generated proxy code breaks DrupalKernelTest, but only when the test is run from the GUI. The generated proxy classes conflict with the ones in the test container loaded from the disk.

Proposed resolution

Remaining tasks

User interface changes

API changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Issue tags: +SprintWeekend2015

So we talk about the problem of using multiple different include_once statements for different compiled containers? PUH

dawehner’s picture

Well, the simplest idea would be to wrap the class_exists()

znerol’s picture

I've traced down the problem to the following difference between the CLI test runner and the GUI: The former does not dump its container, while the latter does.

I believe the following happens in the GUI:

  1. Test runner loads the compiled kernel from the disk (contains service_container_prod including a couple of generated proxy classes)
  2. DrupalKernelTest::testCompileDIC() compiles a new container, dumps it to the disk (line 82)
  3. DrupalKernelTest::testCompileDIC() tries to load the compiled container from disk (line 86). The file contains service_container_testing including a couple of generated proxy classes. However the proxies have the same names as the ones loaded before by the test runner.
znerol’s picture

Status: Active » Needs review
FileSize
2.19 KB

How about just use a environment based namespace for the dumped container?

znerol’s picture

Adding tests. The test-only patch is also the interdiff.

znerol’s picture

The last submitted patch, 5: 2409247-TEST-ONLY-namespaced-container.diff, failed testing.

jibran’s picture

+1 from me this looks good.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great fix!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This issue addresses a major bug and is allowed per https://www.drupal.org/core/beta-changes. Committed 722c8dd and pushed to 8.0.x. Thanks!

  • alexpott committed 722c8dd on 8.0.x
    Issue #2409247 by znerol: Generated proxy classes break DrupalKernelTest...

Status: Fixed » Closed (fixed)

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