I have a Zend-Framework 2 Project and i have problems to organize my unit-tests. My unit-test are located in one "test"-folder for each module. If I run the test from the command line with phpunit in the test folder of a module, the test will run successfully.
Example:
c:\project\module\AccessControl\test>phpunit
PHPUnit 3.7.14 by Sebastian Bergmann.
Configuration read from c:\project\module\AccessControl\test\phpunit.xml
........Time: 0 seconds, Memory: 8.25Mb
OK (8 tests, 10 assertions)
Problem: Here only one module will be testet. But I want to run a single testsuite from the folder c:\project\ to test the hole project. There I have put a bootstrap.php and a phpunit.xml.
From the command line I run it with:
C:\project\tests>phpunit --debug --configuration phpunit.xml
PHPUnit 3.7.14 by Sebastian Bergmann.
Configuration read from C:\project\tests\phpunit.xml
Starting test 'AccessControlTest\Model\AuthenticationTest::testInitDefault'.
PHP Fatal error: Class 'AccessControlTest\Bootstrap' not found in C:\project\module\AccessControl\test\AccessControlTest\Model\AuthenticationTest.php on line 22
PHP Stack trace:
PHP 1. {main}() C:\Program Files (x86)\PHP\phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() C:\Program Files (x86)\PHP\phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() C:\Program Files (x86)\PHP\PEAR\PHPUnit\TextUI\Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() C:\Program Files (x86)\PHP\PEAR\PHPUnit\TextUI\Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() C:\Program Files (x86)\PHP\PEAR\PHPUnit\TextUI\TestRunner.php:346
PHP 6. PHPUnit_Framework_TestSuite->run() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestSuite.php:705
PHP 7. PHPUnit_Framework_TestSuite->runTest() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestSuite.php:745
PHP 8. PHPUnit_Framework_TestCase->run() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestSuite.php:775
PHP 9. PHPUnit_Framework_TestResult->run() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestCase.php:769
PHP 10. PHPUnit_Framework_TestCase->runBare() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestResult.php:648
PHP 11. AccessControlTest\Model\AuthenticationTest->setUp() C:\Program Files (x86)\PHP\PEAR\PHPUnit\Framework\TestCase.php:821
The file phpunit.xml looks like this:
<phpunit bootstrap="./Bootstrap.php" colors="true" verbose="true">
<testsuite name="SgtrCatalogTestsuite">
<directory>../module/AccessControl</directory>
</testsuite>
</phpunit>
It looks like some modulepaths are not correct. Can somebody help and tell me how to setup this?
EDIT Ty for your replys!!!
In the meantime i found this: How to consolidate ZF2 unit/application module tests into a single call?
It seems not possible to run all module-tests from rootlevel. I try now to use this and let u know if it works: https://github.com/prolic/HumusPHPUnitModule