作者:广东庚舞飞扬 | 来源:互联网 | 2023-05-19 01:10
Iamusingzendframework1.12.11andnowIwanttousePHPunitwithit.Pearhasstoppeditsstoppe
I am using zend framework 1.12.11 and now I want to use PHPunit with it.Pear has stopped it's stopped support for phpunit.Now it's working with composer. I have install composer and phpunit via composer.But Where I have to put composer json setting file and my project and what should include in my project which automatically take phpunit of composer
我正在使用zend框架1.12.11,现在我想用它来使用PHPunit.Pear已停止它停止支持phpunit.Now它正在使用composer。我已经通过composer安装了composer和phpunit。但是我必须把作曲家json设置文件和我的项目放在哪里以及我的项目中应该包含哪些内容自动取出作曲家的phpunit
1 个解决方案
Per the PHPUnit documentation for Composer installation, add PHPUnit to the dependencies in your project's composer.json
file, something like:
根据Composer安装的PHPUnit文档,将PHPUnit添加到项目的composer.json文件中的依赖项,如:
{
"require-dev": {
"phpunit/phpunit": "4.6.*"
}
}
Then run:
composer update -vvv phpunit/phpunit
to actually bring PHPUnit and its dependencies down into your project.
实际上将PHPUnit及其依赖项带入您的项目中。
I usually add the -vvv (maximally verbose) flag to see what's going on under the hood. Feel free to omit if you prefer.
我通常添加-vvv(最大详细)标志来查看引擎盖下发生了什么。如果您愿意,可以随意省略。
Once they are all installed, you can run phpunit
the usual way by accessing the executable bin script that PHPUnit and Composer expose for you. From the project root, you should be able to run:
一旦安装完毕,您可以通过访问PHPUnit和Composer为您公开的可执行bin脚本以通常的方式运行phpunit。从项目根目录,您应该能够运行:
./vendor/bin/phpunit --version
to confirm the install is ok.
确认安装没问题。
Once you have a phpunit.xml
config file set up that your test suites and directories, you should be able to run your tests using:
一旦你有一个phpunit.xml配置文件设置你的测试套件和目录,你应该能够使用以下命令运行你的测试:
./vendor/bin/phpunit -c /path/to/phpunit.xml