我在以下位置添加了 PHPUnit 依赖项composer.json:
"require": {
"php-ds/php-ds": "v1.2.0",
"phpunit/phpunit": "v7.5.16"
}
Run Code Online (Sandbox Code Playgroud)
并运行我已经php-ds安装的composer update 。
这在供应商目录中安装了 PHPUnit,但是当我检查phpunit命令行时,它说:
找不到phpunit命令
Ger*_*che 12
$ phpunit当您在命令行(例如 bash)上运行时,系统将从bash 文档中查找phpunit使用该变量:PATH
PATH The search path for commands. It is a colon-separated list of directories in which the shell\n looks for commands (see COMMAND EXECUTION below). A zero-length (null) directory name in the\n value of PATH indicates the current directory. A null directory name may appear as two adja\xe2\x80\x90\n cent colons, or as an initial or trailing colon. The default path is system-dependent, and\n is set by the administrator who installs bash. A common value is ``/usr/local/bin:\n /usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin\'\'.\nRun Code Online (Sandbox Code Playgroud)\n\n您可以使用绕过搜索PATH通过使用绝对路径来绕过使用变量的搜索:
$ /absolute/path/to/vendor/bin/phpunit\nRun Code Online (Sandbox Code Playgroud)\n\n或相对路径(停止字符(.)表示当前目录):
$ ./vendor/bin/phpunit\nRun Code Online (Sandbox Code Playgroud)\n\n您实际上省略了停止斜杠部分:$ vendor/bin/phpunit。
为了避免键入路径,您可以使用 bash 别名(如果您使用的是 bash):
\n\n$ alias phpunit=\'./vendor/bin/phpunit\'\nRun Code Online (Sandbox Code Playgroud)\n\n或者保存输入:
\n\n$ alias p=\'./vendor/bin/phpunit\'\nRun Code Online (Sandbox Code Playgroud)\n\n请参阅如何创建永久 bash 别名有关别名的更多信息,
\n| 归档时间: |
|
| 查看次数: |
3124 次 |
| 最近记录: |