问题
Solved - see answer below
I have a problem. I'm trying to test some functional tests with phpunit. The problem is that when i use phpunit -c app
in command prompt I get No tests executed!.
It seems that the path to my application is not right. I tried to change the path in my phpunit.xml.dist. I changed it many times, but the "guess" standard code seems to be the best,
<directory>../src/*/*Bundle/Tests</directory>
<directory>../src/*/Bundle/*Bundle/Tests</directory>
Those links doesn't seem to work. I also looked for the file "phpunit.xml" because it could overwrite my .dist file. I do not have the file.
also i checked symfony docs. I tought it was maby the fact that i have a "LocalAppKernel". so i tried:
<server name="KERNEL_DIR" value="../app/" />
This does not work either. The tests are auto generated (with a few small additions) so that should not be the problem.
My bundle is located in the vendor map and not in the src map (as standard used by phpunit).
So what should i do to fix this? I have looked everywhere on the internet, but cannot seem to find a solution for my problem.
回答1:
I execute the test of the other vendor of my project with this configuration:
/app/phpunit.xml.dist
<testsuites>
<testsuite name="Project Test Suite">
<directory>../vendor/vendorname/vendor-catalog-bundle/Acme/DemoCatalogBundle/Tests/Entity</directory>
<directory>../src/*/*Bundle/Tests</directory>
<directory>../src/*/Bundle/*Bundle/Tests</directory>
<directory>../vendor/vendorname/acme-validator-bundle/Acme/DemoBundle/Tests</directory>
</testsuite>
</testsuites>
Hope this help
来源:https://stackoverflow.com/questions/29409761/phpunit-in-symfony2-no-tests-executed