Skip to content

Remove obsolete error handler that marked every test as risky#386

Merged
jbrooksuk merged 1 commit into
mainfrom
fix/risky-tests-error-handler
Jul 13, 2026
Merged

Remove obsolete error handler that marked every test as risky#386
jbrooksuk merged 1 commit into
mainfrom
fix/risky-tests-error-handler

Conversation

@jbrooksuk

Copy link
Copy Markdown
Member

Problem

Every test (675) is reported as risky in every CI matrix job — e.g. this run. The compact CI output hides the reason, but running a single test locally shows:

RISKY: Test code or tested code removed error handlers other than its own

Cause

workbench/bootstrap/suppress-deprecations.php (added in d1e0e50) registers a global error handler at autoload time via Composer's autoload-dev.files, so it sits beneath PHPUnit's handler in every test's baseline. Laravel's HandleExceptions::flushHandlersState() pops the entire error handler stack when Testbench tears the app down between tests. PHPUnit 12 then sees that a handler from its pre-test baseline is gone and flags the test as risky — for every single test.

Fix

Delete the file and its autoload-dev.files entry. The handler is obsolete:

  • It suppressed the PHP 8.5 PDO::MYSQL_ATTR_SSL_CA deprecation triggered by Testbench's bundled database config.
  • The only PHP 8.5 leg in CI (Laravel 13, prefer-stable) now resolves Testbench 11, whose config already uses the new Pdo\Mysql::ATTR_SSL_CA constant.
  • Older Testbench versions (Laravel 11/12 legs, prefer-lowest) only run on PHP 8.3/8.4, where the constant isn't deprecated.

Verification

Full suite locally after the change:

Tests:    2 todos, 675 passed (2963 assertions)

Zero risky, all passing.

🤖 Generated with Claude Code

The suppress-deprecations bootstrap file registered a global error
handler via Composer's autoload-dev files, beneath PHPUnit's own
handler. Laravel's HandleExceptions::flushHandlersState() pops the
entire error handler stack between tests, so PHPUnit 12 detected that
a handler from its pre-test baseline had been removed and marked all
675 tests as risky ("Test code or tested code removed error handlers
other than its own") in every CI matrix job.

The handler is no longer needed: it suppressed a PHP 8.5 deprecation
for PDO::MYSQL_ATTR_SSL_CA in Testbench's bundled database config, but
the only PHP 8.5 CI leg (Laravel 13, prefer-stable) now resolves
Testbench 11, which already uses Pdo\Mysql::ATTR_SSL_CA. Older
Testbench versions only run on PHP 8.3/8.4, where the constant is not
deprecated.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jbrooksuk jbrooksuk merged commit 499a1d0 into main Jul 13, 2026
28 checks passed
@jbrooksuk jbrooksuk deleted the fix/risky-tests-error-handler branch July 13, 2026 08:27
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.

1 participant