简体   繁体   English

在Symfony2中生成Phpunit骨架测试类

[英]Generating Phpunit skeletons test classes in Symfony2

I got my phpunit test in symfony though I am trying to use PhpUnit skelgen to generate skeleton for my test classes. 尽管我试图使用PhpUnit skelgen为我的测试类生成框架,但我在symfony中得到了phpunit测试。 I had a look at the PhpUnit documentation 我看了PhpUnit 文档

phpunit-skelgen --test -- "project\Calculator" Calculator.php

My path for the file i want to generate skeleton is: 我要生成骨架的文件的路径是:

Boltmail\UserBundle\BoltmailFactory\UserLoginFactory.php

and following the documentation i have inserted the following: 并按照文档插入以下内容:

./bin/phpunit-skelgen --test -- "Boltmail\UserBundle\BoltmailFactory\UserLoginFactory" UserLoginFactory.php

And this keeps on throwing InvalidArgumentException: 并且继续抛出InvalidArgumentException:

 [InvalidArgumentException]                                                      
  Command "Boltmail\UserBundle\BoltmailFactory\UserLoginFactory" is not defined.

Any idea guys where i am going wrong with all the before you ask yes i have installed phpunit and phpunit-skelgen through my composer.json 任何想法的人我在哪里都出错了,然后再问是的我已经通过composer.json安装了phpunit和phpunit-skelgen

OK After a suggestion in a below answer i changed my terminal command to this: 确定在以下答案中的建议后,我将终端命令更改为:

./bin/phpunit-skelgen --bootstrap app\bootstrap.php.cache --test -- "Boltmail\UserBundle\BoltmailFactory\UserLoginFactory"

Now I get this error: 现在我得到这个错误:

[InvalidArgumentException]                        
  Command "appbootstrap.php.cache" is not defined.

Before all these i did: 在我完成所有这些操作之前:

composer update which installed bootstrap/php/cache under app/ dir 作曲家更新,它在app /目录下安装了bootstrap / php / cache

You need to add 您需要添加

--bootstrap app\\bootstrap.php.cache to arguments for phpunit-skelgen --bootstrap app\\bootstrap.php.cachephpunit-skelgen参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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