/** * this introduces global state in your application which can not be mocked up for testing * and is therefor considered an anti-pattern! Use dependency injection instead! * * @var Service[] */ privatestaticarray$services = [];
/** * notice @runInSeparateProcess here: without it, a previous test might have set it already and * testing would not be possible. That's why you should implement Dependency Injection where an * injected class may easily be replaced by a mockup * * @runInSeparateProcess */ publicfunctiontestThrowsExceptionWhenTryingToGetNotSetKey() { $this->expectException(InvalidArgumentException::class);