Skip to content

[StimulusBundle] Bound the test kernel cache directory and drop dead phpunit env vars - #3850

Merged
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:test/stimulus-test-setup
Sep 9, 2026
Merged

Kocal merged 1 commit into
symfony:3.xfrom
Kocal:test/stimulus-test-setup

Conversation

@Kocal

@Kocal Kocal commented Sep 9, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? no
New feature? no
Deprecations? no
Documentation? no
Issues
License MIT

StimulusIntegrationTestKernel::getCacheDir() derived its path from spl_object_hash($this), the object handle, so the directory changed whenever the allocation pattern did, and nothing ever removed it. On the machine this was written on, the temp directory had accumulated 655 of these directories, 514 MB. The path is now fixed, so there's one known location holding one cache; getLogDir() gets the same treatment for consistency. This is about bounding the accumulation, not about test speed: the suite runs in about the same time either way.

phpunit.dist.xml carried two environment variables inherited from Autocomplete's configuration: KERNEL_CLASS, pointing at a Symfony\UX\Autocomplete\Tests\Fixtures\Kernel class this package can't autoload, and DATABASE_URL, for a database it has no dependency on. Nothing reads either one, since the only WebTestCase here overrides getKernelClass(). Both are removed.

…phpunit env vars

| Q              | A
| -------------- | ---
| Bug fix?       | no
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         |
| License        | MIT

`StimulusIntegrationTestKernel::getCacheDir()` derived its path from `spl_object_hash($this)`, the object handle, so the directory changed whenever the allocation pattern did, and nothing ever removed it. On the machine this was written on, the temp directory had accumulated 655 of these directories, 514 MB. The path is now fixed, so there's one known location holding one cache; `getLogDir()` gets the same treatment for consistency. This is about bounding the accumulation, not about test speed: the suite runs in about the same time either way.

`phpunit.dist.xml` carried two environment variables inherited from Autocomplete's configuration: `KERNEL_CLASS`, pointing at a `Symfony\UX\Autocomplete\Tests\Fixtures\Kernel` class this package can't autoload, and `DATABASE_URL`, for a database it has no dependency on. Nothing reads either one, since the only `WebTestCase` here overrides `getKernelClass()`. Both are removed.
@Kocal Kocal self-assigned this Sep 9, 2026
@Kocal
Kocal merged commit 2ae1ac9 into symfony:3.x Sep 9, 2026
33 checks passed
@Kocal
Kocal deleted the test/stimulus-test-setup branch September 9, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants