在 Windows 中使用 PEAR 和不使用 PEAR 安装 PHPUnit 时都会出现问题

发布于 2024-10-02 15:15:49 字数 284 浏览 0 评论 0原文

我尝试使用 PEAR 连接到 pear.phpunit.de 和其他三个类似的连接,但由于连接超时而无法连接,在更新 PEAR 中的连接后,没有任何进展。

另外,我尝试通过更改 phpunit.php 文件中的 @PHPBIN@ 并重命名它来安装没有 PEAR 的 PHPunit,然后无法在 DOS 中将其作为可执行文件运行(chmod 在 DOS 中不起作用,是按步骤编写的,我遵循了)

是否有任何其他简单的方法可以让 PHPUnit 在 Wamp 服务器下的 Windows 中工作。请回复,目前所有事情都悬而未决。

I have tried connecting to pear.phpunit.de and three other similar connections using PEAR, but could not due to connection timeout, after updating connection also in PEAR, no progress.

Also, I have tried installing PHPunit without PEAR by changing @PHPBIN@ in phpunit.php file and renaming it, then cannot run it as an executable file in DOS (chmod does'nt work in DOS, was written in steps, which i followed)

Is there any other simple way to get PHPUnit working in Windows under Wamp server. Please respond, all things hanging on it presently.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情绪操控生活 2024-10-09 15:15:49

尝试:

pear clear-cache
pear update-channels
pear install --alldeps phpunit/PHPUnit

如果 PHPUnit 安装了,但您仍然无法运行单元测试,您可能必须将 phpunit 文件移到一个目录下。因此,如果您的 php.exe 文件位于 C:\wamp\bin\php\php5.2.11\ 中,您应该有如下内容:

C:\wamp\bin\php\php5.2.11\phpunit.bat
C:\wamp\bin\php\php5.2.11\phpunit
C:\wamp\bin\php\php5.2.11\PEAR\phpunits

Try:

pear clear-cache
pear update-channels
pear install --alldeps phpunit/PHPUnit

If PHPUnit installs, but you still can't run a unit test, you might have to move the phpunit file down one directory. So if your php.exe file is in C:\wamp\bin\php\php5.2.11\ you should have something like this:

C:\wamp\bin\php\php5.2.11\phpunit.bat
C:\wamp\bin\php\php5.2.11\phpunit
C:\wamp\bin\php\php5.2.11\PEAR\phpunits
樱花细雨 2024-10-09 15:15:49
pear config-set temp_dir D:\temp

问题是临时目录路径中的空格阻止 pear 安装软件包。

还尝试清空 pear 缓存目录(%appdata% 本地临时目录中的某个位置)。

pear config-set temp_dir D:\temp

the problem is that whitespaces in the path of the temp dir prevents pear from installing the package.

Also try to empty the pear cache directory (somewhere in %appdata% local temp).

故乡的云 2024-10-09 15:15:49

自 2014 年 12 月 31 日起,pear.phpunit.de 将被关闭,因此这是在您的计算机上配置 PHPUnit 的另一种方法:

  • 首先,确保您能够从命令提示符执行“php --version”而不会出现错误。如果确实出现错误,请将“php.exe”的路径添加到 PATH 环境变量中(例如,我的路径位于“C:\xampp\php”下)
  • https://phar.phpunit.de/phpunit.phar
  • 将此文件移动到您希望保留 phpunit 安装的文件夹(在本例中我将使用“C:\phpunit”)
  • 在“C:\phpunit\”下创建一个新的文本文件并将其重命名为“phpunit.cmd”
  • 右键单击并打开“phpunit.cmd”在编辑模式下,复制并粘贴以下行并保存文件:

    <块引用>

    @php"%~dp0\phpunit.phar"%*

  • 此时你应该在 "C:\phpunit" 下有 "phpunit.cmd" 和 "phpunit.phar"

  • 转到系统变量并编辑 PATH 变量
  • 将此行添加到 PATH 变量的开头,不要忘记分号:

    <块引用>

    C:\phpunit;

  • 单击“确定”保存编辑,打开命令提示符并输入“phpunit --version”

As of December 31 2014 pear.phpunit.de will be shut down, so here is another way of configuring PHPUnit on your machine:

  • First, make sure that you are able to execute "php --version" from Command Prompt without getting an error. If you do get an error, add the path to "php.exe" to your PATH environment variable (mine is under "C:\xampp\php" for example)
  • Download "phpunit.phar" from https://phar.phpunit.de/phpunit.phar
  • Move this file to a folder in which you wish to keep the phpunit installation (I'll use "C:\phpunit" in this example)
  • Create a new text file under "C:\phpunit\" and rename it to "phpunit.cmd"
  • Right-click and open "phpunit.cmd" in edit mode, copy>paste the following line and save the file:

    @php"%~dp0\phpunit.phar" %*

  • At this point you should have "phpunit.cmd" and "phpunit.phar" under "C:\phpunit"

  • Go to your system variables and edit your PATH variable
  • Add this line to the very beginning of your PATH variable and don't forget the semicolon:

    C:\phpunit;

  • Click OK to save the edit, Open Command Prompt and type "phpunit --version"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文