PHPUnit 的数据库扩展发生了什么?

发布于 2024-11-24 14:12:11 字数 465 浏览 1 评论 0原文

升级到 PHPUnit 后 v > 3.5(我忘了)我不断收到此错误,因为我导入了 PHPUnit/Extensions/Database/TestCase.php

require_once(...): failed to open stream: No such file or directory

我查看了 /usr/share/php 文件夹中的 PHPUnit 文件夹只是为了找出答案它不再存在了。

事实上,查看官方源代码发现它似乎已被删除。

所以现在我使用的是 3.4.15 版本。但这并不理想,因为桌面上的断言仍然不受支持。目前我只能使用填充我的数据库的 CLEAN_INSERT 功能。

After upgrading to PHPUnit v > 3.5 (I forgot) I kept on getting this error because I imported PHPUnit/Extensions/Database/TestCase.php:

require_once(...): failed to open stream: No such file or directory

I peeked at the PHPUnit folder in my /usr/share/php folder only to find out it isn't there anymore.

In fact a look at the official source code reveals that it seems it has been removed.

So for now I am using version 3.4.15. But it's not ideal as assertions on the table are still not supported. For now I am only able to use the CLEAN_INSERT feature which populates my database.

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

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

发布评论

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

评论(6

口干舌燥 2024-12-01 14:12:12

在当前稳定的 PHPUnit (4.5) 上,DbUnit 是一个可选包,可以与 Composer 一起安装:
https://phpunit.de/manual/current/en/installation .html#installation.Optional-packages

(如果您不熟悉 Composer,请单击“Composer”超链接 - 我不熟悉,大约 10 分钟即可轻松设置)

我费了好大劲才发现那个,但是正在运行旧版本的 PHPUnit,并且在几个地方都有它,所以我将其从 /usr/local/bin 和 /usr/bin 中删除,然后按照此处找到的“全局安装 PHAR”说明进行操作:
https://phpunit.de/manual/4.5/en/installation.html

我使用 pear 来安装 PHPUnit 的运气并不好。

(我在运行 Yosemite 的 Mac 上)。

On the current stable PHPUnit (4.5), DbUnit is an optional package that can be installed with Composer:
https://phpunit.de/manual/current/en/installation.html#installation.optional-packages

(click the "Composer" hyperlink if you're not familiar with Composer--I wasn't and it was easy to set up in about 10 minutes)

I struggled before I found that, but was running with an older version of PHPUnit, and had it in a few places, so I removed it from /usr/local/bin and /usr/bin and then followed the instructions "To globally install the PHAR" found here:
https://phpunit.de/manual/4.5/en/installation.html

I didn't have much luck using pear to install PHPUnit.

(I'm on a Mac running Yosemite).

緦唸λ蓇 2024-12-01 14:12:11

您的安装似乎已损坏。 PHPUnit 3.5 被分割成更多单独的包。

使用 pear install phpunit/dbUnit 来安装该部分。

软件包概述:http://pear.phpunit.de/


或者重新安装所有内容,使用:pear install --force -- alldeps phpunit/phpunit


2013 更新:

只需使用 composer到安装 PHPUnit。这样就少了一些麻烦。

Your installation seems broken. PHPUnit 3.5 got split up in more seperate packages.

Use pear install phpunit/dbUnit to install that part.

Package overview: http://pear.phpunit.de/


Or to reinstall everything use: pear install --force --alldeps phpunit/phpunit


2013 update:

Just use composer to install PHPUnit. It's less hassle.

橙味迷妹 2024-12-01 14:12:11

用这个

pear install phpunit/PHPUnit_Story

Use this

pear install phpunit/PHPUnit_Story
星星的轨迹 2024-12-01 14:12:11

我通过手动安装数据库单元解决了这个问题。我从此处下载它。然后我用下载的文件夹替换了不完整的 Extensions/Database 文件夹。

I solved this by installing db unit manually. I downloaded it from here. Then I replaced the incomplete Extensions/Database folder with the one from the download.

司马昭之心 2024-12-01 14:12:11

对于那些运行 macports 的用户,您必须安装 php5-unit-db 端口才能获取所需的文件。这确实帮助我开始寻找正确的方向。默认情况下未安装此 dep。

For those that are running macports, you will have to install the php5-unit-db port to get the needed files. This did help me start looking in the right direction. This dep was not installed by default.

北方。的韩爷 2024-12-01 14:12:11

这应该可以解决安装 PHPUnit 的所有问题:

pear install --alldeps --force phpunit/PHPUnit

This should solve all problems with installing PHPUnit:

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