Repository navigation
#303 - Tests: detect the deprecations and boot a kernel - #304
Merged
Merged
Conversation
- PHPUnit fails on deprecations (failOnDeprecation, details displayed), the silenced ones included (ignoreSuppressionOfDeprecations). The new tests/bootstrap.php enables the Symfony DebugClassLoader (@Final, @internal, return types). - New functional test booting a kernel (FrameworkBundle and this bundle): every task of config/services/task.yaml resolves by its code through TaskRegistry, every transformer is resolved by TransformerRegistry, and a process (constant_output -> transformer) runs. The logger is a NullLogger: the default logger of FrameworkBundle may print the process logs (risky test). - The tests of a deprecated feature whose deprecation is checked by another test ignore it (new IgnoreDeprecationsTrait): RegistryCompilerPass, the "service" option of the tasks, the "additional_parameters" option of CallbackTransformer. - DenormalizeTransformerTest: dates in the default format (symfony/serializer 8.1 deprecates the loose parsing). - The exception handler of the ErrorHandler registered at boot is restored after each kernel test (not removed by the first Symfony 6.4 versions); framework.property_info.with_constructor_extractor set from Symfony 7.3, condition kept by Rector. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
njoubert-cleverage
force-pushed
the
303
branch
from
October 20, 2026 08:29
a4a4f12 to
80cd9ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #303. Same work as in the bridge bundles (cleverage/archive-process-bundle#42, cleverage/cache-process-bundle#60, cleverage/doctrine-process-bundle#61, cleverage/flysystem-process-bundle#62, cleverage/rest-process-bundle#66, cleverage/soap-process-bundle#59, cleverage/ui-process-bundle#184).
Deprecation detection
phpunit.xml.dist:failOnDeprecationanddisplayDetailsOnTestsThatTriggerDeprecations;<source ignoreSuppressionOfDeprecations="true">, so that the deprecations triggered withtrigger_deprecation()(silenced@trigger_error()) are reported. NoignoreIndirectDeprecations: it also hides theDebugClassLoaderdeprecations about the classes of the bundle.tests/bootstrap.php:DebugClassLoader::enable()(extending a@final/@internalclass, missing return types...).Kernel test
tests/App/TestKernel.php+tests/Functional/KernelTest.php(#[CoversNothing]): FrameworkBundle and this bundle, the container is compiled and:config/services/task.yaml(58 codes, read from thecleverage.tasktags) resolves by its code throughTaskRegistry, with its dependencies;TransformerRegistry;constant_output→transformerwithsprintf) runs and returns its output.loggerservice of the test kernel is aNullLogger: the default logger of FrameworkBundle may print the process logs, which makes the test risky ("printed unexpected output").KernelTestrestores the exception handler of theErrorHandlerregistered when the kernel boots, which the first Symfony 6.4 versions do not remove (risky test with the lowest dependencies).TestKernelsetsframework.property_info.with_constructor_extractorfrom Symfony 7.3 (not setting it is deprecated there);rector.phpskipsRemoveAlwaysTrueIfConditionRectorfortests/App/TestKernel.php.Deprecations revealed by the tests (tests only, no change in
src/)tests/IgnoreDeprecationsTrait.php:RegistryCompilerPass(checked bytestIsDeprecated()), theserviceoption of the tasks (ConfigurationTest::testServiceIsDeprecated()), theadditional_parametersoption ofCallbackTransformer(testAdditionalParametersAreDeprecated()).DenormalizeTransformerTest::testCollectionClassIsSupported(): dates in the default format, symfony/serializer 8.1 deprecates parsing2024-01-02with the loose constructor.Checked in the container (964 tests): highest dependencies (PHP 8.5, Symfony 8.1, PHPUnit 13), lowest dependencies (PHP 8.2, Symfony 6.4.0, PHPUnit 11.5), Symfony 6.4.48 on PHP 8.2 and 8.5, Symfony 7.4: no deprecation, no risky test (with pcov coverage); PHPStan, PHP-CS-Fixer and Rector OK. A deprecation makes PHPUnit exit with code 1.
Requirements
Breaking changes
None: tests and CI only.
🤖 Generated with Claude Code