Skip to content

#181 - Tests: detect the deprecations - #184

Merged
njoubert-cleverage merged 1 commit into
mainfrom
181
Oct 20, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
181

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #181 (bridge part of cleverage/process-bundle#303), fixes #152. The tests already boot a kernel with process-bundle: this PR adds the deprecation detection, as in the other bridges (e.g. cleverage/rest-process-bundle#66), and fixes the deprecations it reveals.

Deprecation detection

  • phpunit.xml.dist: failOnDeprecation, displayDetailsOnTestsThatTriggerDeprecations, <source ignoreSuppressionOfDeprecations="true"> (deprecations triggered with trigger_deprecation() are reported).
  • New tests/bootstrap.php: DebugClassLoader::enable().

Deprecations fixed in src/ (no behavior change)

  • ProcessExecutionRepository::getLastProcessExecution(): doctrine/orm 3.7 deprecates the string sort directions (Doctrine ORM 3.7 deprecation: string sort direction in ProcessExecutionRepository #152). The \SortDirection enum is passed when orderBy() accepts it (checked once by reflection), the string otherwise.
  • ProcessExecutionRepository::hasLogs(): "Using WITH for the join condition of arbitrary joins is deprecated" (doctrine/orm 3.7): the log records are counted with a simple SELECT count(lr.id) FROM LogRecord lr WHERE lr.processExecution = :processExecution, same result with ORM 2 and 3.
  • Date filters (createdAt of the log records, startDate of the process executions): "Not configuring the widget option of form type datetime is deprecated" (Symfony 6.4). EasyAdmin (up to 5.7) replaces the value_type_options of its date filter type and loses its single_text widget: it is set on the filters. Nothing changes with Symfony 7+ (single_text is the default there); with Symfony 6.4, the filter is a single field instead of select boxes.
  • User::eraseCredentials() is marked #[\Deprecated], as required by Symfony 7.3 ("Implementing eraseCredentials() is deprecated", AuthenticatorManager), which then no longer calls it (symfony/polyfill-php84 provides the attribute before PHP 8.4). Trade-off: Symfony 6.4 still calls it, so with Symfony 6.4 and PHP 8.4+ PHP triggers a deprecation at each login; it can be avoided with security.erase_credentials: false (the method is empty). Documented in the CHANGELOG.

Test application

  • Processes moved to tests/App/config/processes.yaml, written with task: <code>; TestKernel converts them to service: with process-bundle < 5.4 (task: does not exist there, service: is deprecated in 5.4).
  • test.failing / test.notification_failing now fail at execution (missing file) instead of initialization, which process-bundle deprecates (#222 of the core).
  • Symfony 7.0 defaults set explicitly (their absence is deprecated with Symfony 6.4): handle_all_throwables, php_errors.log, uid UUID versions, session handler and cookies; property_info.with_constructor_extractor from Symfony 7.3; security.erase_credentials: false before Symfony 7.3 (see above).
  • Tests: the expected deprecation of the former process_list route is captured and checked, eraseCredentials() called with its deprecation silenced, HTML5 email validation in UserCreateCommandTest, missing #[UsesClass] in LogRecordCrudTest, new failure message in HttpProcessExecuteTest.
  • masterminds/html5 ^2.7.5 in dev: 2.6 (lowest) triggers a PHP 8.1 deprecation.
  • rector.php skips RemoveAlwaysTrueIfConditionRector for tests/App/TestKernel.php (conditions on the Symfony version, always true with the installed version only).

Checked in the container (453 tests): highest (PHP 8.5, Symfony 8.1, PHPUnit 13), lowest (PHP 8.2, Symfony 6.4.33, PHPUnit 10.5), Symfony 6.4.48 on PHP 8.2 and 8.5, Symfony 7.4, process-bundle dev-main: no deprecation, no risky test; PHPStan, PHP-CS-Fixer and Rector OK.

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

None. With Symfony 6.4 and PHP 8.4+, User::eraseCredentials() now triggers a PHP deprecation when called (see above).

🤖 Generated with Claude Code

- 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).
- Deprecations fixed in src:
  - ProcessExecutionRepository::getLastProcessExecution(): \SortDirection
    enum when doctrine/orm accepts it (3.7+, string directions deprecated
    there), the string otherwise (#152).
  - ProcessExecutionRepository::hasLogs(): count the log records without an
    arbitrary join (WITH deprecated by doctrine/orm 3.7), same result.
  - Date filters (createdAt of the log records, startDate of the process
    executions): single_text widget, not configuring it is deprecated by
    Symfony 6.4 (EasyAdmin replaces the value_type_options of its filter).
  - User::eraseCredentials() marked #[\Deprecated], as required by Symfony
    7.3 (polyfilled before PHP 8.4).
- Test application: the processes reference the tasks by code (task:) with
  process-bundle 5.4, by service before; failing processes fail at execution
  instead of initialization (deprecated by process-bundle); Symfony 7.0
  defaults set explicitly (deprecated when missing with Symfony 6.4);
  property_info.with_constructor_extractor from Symfony 7.3;
  security.erase_credentials disabled before Symfony 7.3 (Symfony 6.4 calls
  the #[\Deprecated] eraseCredentials(), deprecation with PHP 8.4+).
- Tests: expected deprecations captured (deprecated route alias, deprecated
  eraseCredentials()), HTML5 email validation, missing UsesClass.
- masterminds/html5 ^2.7.5 in dev (2.6 triggers a PHP 8.1 deprecation).
- Rector does not remove the conditions on the Symfony version of the test
  kernel (always true with the installed version only).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 4467554 into main Oct 20, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tests: detect the deprecations Doctrine ORM 3.7 deprecation: string sort direction in ProcessExecutionRepository

1 participant