简体   繁体   中英

phpunit in symfony2 - No tests executed

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM