PHPUnit生成的测试框架路径 [英] PHPUnit generated test skeleton path

查看:74
本文介绍了PHPUnit生成的测试框架路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过--skeleton-test命令告诉phpunit将生成的测试框架文件放在哪里?甚至可以告诉phpunit重复目录结构吗? 唯恐我在lib/model/SomeClass.php中有待测试的文件,并且我希望phpstorm生成单元测试类并将其放在test/lib/model/SomeClassTest.php中,而无需创建所有必要的目录结构.

Is it possible to tell phpunit where to put generated test skeleton file by the --skeleton-test command? Even is it possible to tell phpunit to repeat directory structure? Lest say i have file for testing in lib/model/SomeClass.php and i want phpstorm to generate unit test class and put it in test/lib/model/SomeClassTest.php without creation of all neccessary directory structure.

提前谢谢!

推荐答案

为方便起见复制了示例

mkdir lib/model tests/lib/model
echo "<?php class SomeClass{}" > lib/model/SomeClass.php

调用下面的代码应该可以解决问题

Calling the code below should do the trick

phpunit --skeleton-test SomeClass library/model/SomeClass.php SomeClassTest tests/library/model/SomeClassTest.php

参数(只有第一个是强制性的)

The arguments (only the first one being mandatory) are

$inClassName, 
$inSourceFile = '',
$outClassName = '',
$outSourceFile = ''

,如PHPUnit_Util_Skeleton_Class

这篇关于PHPUnit生成的测试框架路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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