Validate("expectException(\Exception::class); try{ $oiTopConfigValidator->Validate(""); } catch (\Exception $e) { if (version_compare(phpversion(), '8.0.0', '<')) { $this->assertStringStartsWith('Error in configuration: syntax error, unexpected \'zdadz\' (T_STRING)', $e->getMessage()); } else { $this->assertStringStartsWith('Error in configuration: syntax error, unexpected identifier "zdadz" at line 2', $e->getMessage()); } throw $e; } } }