您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
phpunit中configuration免加载phpunit.xml
发布时间:2021-09-20 19:56:18编辑:雪饮阅读()
上篇中配置了组织测试中对于testsuite的配置。
那么这里同样以上篇中的组织测试为例,了解下phpunit如何不使用configuration指定phpunit.xml也能加载phpunit.xml中的配置。
那么像是之前我们需要通过configuration加载phpunit.xml如:
C:\Users\Administrator>D:\phpstudy_pro\Extensions\php\php7.3.4nts\php.exe D:\phpstudy_pro\Extensions\php\php7.3.4nts\phpunit-9.5.8.phar --configuration C:\Users\Administrator\PhpstormProjects\untitled\organizing\phpunit.xml --testsuite database
PHPUnit 9.5.8 by Sebastian Bergmann and contributors.
.... 4 / 4 (100%)
Time: 00:00.006, Memory: 20.00 MB
OK (4 tests, 5 assertions)
但是如果cmd当前工作目录就正好是phpunit.xml所在目录,则不需要显示加载phpunit.xml
像是下面这样
C:\Users\Administrator>cd C:\Users\Administrator\PhpstormProjects\untitled\organizing
C:\Users\Administrator\PhpstormProjects\untitled\organizing>D:\phpstudy_pro\Extensions\php\php7.3.4nts\php.exe D:\phpstudy_pro\Extensions\php\php7.3.4nts\phpunit-9.5.8.phar --testsuite database
PHPUnit 9.5.8 by Sebastian Bergmann and contributors.
.... 4 / 4 (100%)
Time: 00:00.007, Memory: 20.00 MB
OK (4 tests, 5 assertions)
这里先将工作目录在cmd中切换到我们之前组织测试的目录中,这个目录中正好就有phpunit.xml,所以就可以免加载了,默认自动从此文件中读取配置。
关键字词:phpunit,configuration,phpunit.xml