symfony2中的phpunit

编程入门 行业动态 更新时间:2024-10-11 17:29:44
本文介绍了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

本文发布于:2023-06-03 09:48:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/471169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:phpunit

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!