error about global side-effects in non-isolated tests

Open
#265 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
php
Domain
testing

Research direction

Start by reviewing the PHPUnit process-isolation cases named in the issue, including @runInSeparateProcess and @runTestsInSeparateProcesses. Define how tests that change error reporting, handlers, wrappers, or global variables should be detected and how isolated tests are exempted; done means the requested global side effects produce errors only for non-isolated tests.

Written by the indexing model from the issue text.

Description

I think it would be helpful if we could error in tests which trigger a global side-effect like e.g.

  • error_reporting(E_ALL) when not restored to the old value within the test, see example
  • things like registration of a shutdown/autoload/tick/error-handler/exception-handler/stream-wrapper/...-function without cleanup
  • changes in global/super-global variables

no error should appear in case such a pattern occurs in tests which a run using PHPUnit process isolation (@runInSeparateProcess, @runTestsInSeparateProcesses, etc)

Dominant language
PHP
Stars
544
Forks
58
Avg merge
2d 1h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-phpunit

All issues in phpstan/phpstan-phpunit

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.