How to use an XML schema for PHPUnit configuration files to get autocompletion in PHPStorm
Matthias Pigulla · 24. November 2013
Now it turned out that there is also an "official" schema available but mentioned nowhere in the docs.
That was easy to change and now folks will get the
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd" …
markup when they pick the example file from the documentation as a starting point.
Adding the schema definition is less important for validating the configuration file. The primary benefit is that every decent IDE should be able to give you autocompletion and code suggestions based on it.
When using PHPStorm, the schema URL will initially be displayed in red and marked as an error. You need to place the cursor on it, press Alt+Enter and choose "fetch external resource". After that, PHPStorm will keep a local copy of the schema file and use it also for every other project.