DEPRECATION WARNING

This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.

TYPO3 Schulung für PHPUnit Tests

Run commands

All tests in root folder

$ phpunit -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/eh_phpunit/Tests/Unit

With code coverage

$ phpunit --coverage-html=./coverage.html -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/eh_phpunit/Tests/Unit

Run a single test suite

$ phpunit --filter testAddWithTwoValidIntegers -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/eh_phpunit/Tests/Unit/CalculatorTest.php

Run all TYPO3 core tests

$ phpunit -c typo3/sysext/core/Build/UnitTests.xml

Mock object code coverage

phpunit --coverage-html=./coverage.html --filter subscriptionWithValidEmailReturnWelcome -c typo3/sysext/core/Build/UnitTests.xml typo3conf/ext/eh_phpunit/Tests/Unit

If you use the last command and see the genereted coverage you will see that the validateEmail method is not covered

Inspriation

Thank you Helmut Hummel for your scaffold extension GitHub