In one of my older blog posts I already talked about using
phpdbg to generate coverage faster in CI setups (see https://susi.dev/phpdbg-for-coverage). Today I wanted to show you how you can use the
same method to generate the TYPO3 Core Unit Tests coverage (or any other coverage) by directly using
phpdbg in PHPStorm.
Normally, with > 10.000 tests, generating the coverage for the TYPO3 Core takes ages with xdebug which is why I mostly did not generate it at all. However, coverage data is pretty useful both when evaluating existing code as well as when writing new code, just to check how "safe" it is.
phpdbg generating code coverage for the TYPO3 core takes less than 2 minutes. Let's configure it (which should also take less than 2 minutes 😺) and you can try it yourself.
phpdbg is part of any "normal" PHP installation, so we don't need to install any additional libraries.
- Open PHPStorm and go to your Unit Test configuration ("Run / Debug Configuration")
- Choose "Preferred Coverage Engine" ->
- Add interpreter option
-d memory_limit=1024M(to increase the memory available for
phpdbg, otherwise it will most likely fail with an out of memory error)
- Save and enjoy.