Details
Description
When following the initial statement on how to organize PHPUnit tests (taken from: http://www.phpunit.de/manual/current/en/organizing-tests.html), then the file system is the primary option to create a test suite, simply by placing all tests inside a test folder (much like in Java projects)
This makes testing easier and less error prone than having to specify the tests manually inside a separate PHP file. ... in the end it may also increase the acceptance rate within development ![]()
(The PHP file is still important for complex projects)
Attached is a patch that adds support for folder based PHPUnit tests simply by verifying whether a single test folder exists and no main class is present.
If so the test folder is run instead of the AllTests.php file.
Effectively PHPUnit tests can now be organized as if it were a maven project, without requiring any test suite classes.
(Proper setup of sourceDirectory and testSourceDirectory inside the POM is still required as it was before)
Issue Links
- relates to
-
SONARPLUGINS-918
phpunit command generation depends on maven project name
-
Since Sonar PHP Plugin 0.3, phpunit.xml and phpunit.xml.dist file are also supported as bootstrap for test cases.