/** * Switches the target test method to "runTestCaseWithinLoop" when the test method is a generator method. */ protected function runTest() { $this->testMethodNameBackup = $this->getName(false); $ref = new \ReflectionMethod(static::class, $this->testMethodNameBackup); if (!$ref->isGenerator()) { return parent::runTest(); } $this->setName('runTestCaseWithinLoop'); try { return parent::runTest(); } finally { $this->setName($this->testMethodNameBackup); } }