They must be available. However, PHPUnit backs up the global state between tests:
By default, PHPUnit runs your tests in such a way that changes to global and superglobals ($ GLOBALS, $ _ENV, $ _POST, $ _GET, $ _COOKIE, $ _SERVER, $ _FILES, $ _REQUEST) do not affect other tests. Optionally, this isolation can be extended to static class attributes.
so this can be a problem. Also note that
Objects of some classes that are provided by PHP itself, such as PDO, cannot be serialized, and the backup operation is interrupted, for example, when such an object is stored in the $ GLOBALS array.
See the chapter Testing global state in the PHPUnit manual.
source share