A tool to automatically rerun PHPUnit tests when source code changes by Freek Van der Herten

Looks interesting https://github.com/spatie/phpunit-watcher

From https://medium.com/@freekmurze/a-tool-to-automatically-rerun-phpunit-tests-when-source-code-changes-452237c92d25


Solving No matching global declaration available for the validation root.

Had to create a custom XML for Pohoda accounting software, but hit some errors so I decided to make a PHPUnit test for validating it against its XML schema definition (XSD) with PHPs DOMDocument::schemaValidate

/** @test */
public function validateStockXml()
$xml = new \DOMDocument();

$isValid = $xml->schemaValidate('http://www.stormware.cz/schema/version_2/stock.xsd');

Stuck with the following error for a couple of hours 😦

Element ‘{http://www.stormware.cz/schema/version_2/data.xsd}dataPack’: No matching global declaration available for the validation root.

After a lot of trial and error decided to google more and more I finally found the solution at http://www.scriptscoop.me/t/81762e7e42e7/php-xml-validation-no-matching-global-declaration-available-for-the-valida.html

Changing the schema URL to http://www.stormware.cz/schema/version_2/data.xsd instead using http://www.stormware.cz/schema/version_2/stock.xsd solved the problem.

So easy, huh 🙂 Always learning.