symfony2中的phpunit-未执行测试 [英] phpunit in symfony2 - No tests executed

查看:62
本文介绍了symfony2中的phpunit-未执行测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已解决-参见下面的答案

我有问题.我正在尝试使用phpunit测试一些功能测试.问题是当我在命令提示符下使用phpunit -c app时,我得到未执行任何测试!.

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!.

看来我的应用程序路径不正确.我试图在我的 phpunit.xml.dist 中更改路径.我做了很多次更改,但是猜测"标准代码似乎是最好的,

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>

这些链接似乎无效.我还寻找了文件"phpunit.xml",因为它可能会覆盖我的.dist文件.我没有文件.

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.

我也检查了symfony文档.我坚信这是我拥有"LocalAppKernel"的事实.所以我尝试了:

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.

我的捆绑包位于供应商映射中,而不位于src映射中(作为phpunit使用的标准).

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>

希望获得帮助

这篇关于symfony2中的phpunit-未执行测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆