phpunit in symfony2 - No tests executed

孤者浪人 提交于 2019-12-12 15:13:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!