学说+采埃孚 + php单元

发布于 2024-10-08 16:30:13 字数 346 浏览 0 评论 0原文

我将 ZF 1.11 与 Doctrine 1.2 + MySQL 5 集成。我在几个文件中创建了一些 phpunit 的测试。每个测试都会创建数据库并填充它 - 使用 Zend_Db - 然后我使用 Doctrine 的模型执行一些操作,然后使用 Zend_Db 删除数据库。我把它们全部放在名为“tests”的目录中。当我进入目录“tests”并编写 phpunit 命令时,其中一些命令会返回错误,例如“SQLSTATE[42S02]:未找到基表或视图:1146 表'here_db_name.here_table_name'不存在”。 - 但它确实存在,我查过了!有趣的是,当我单独运行每个测试时,一切都绝对没问题。所以,我的问题是:发生了什么事?抱歉,我无法提供代码。

I have ZF 1.11 integrated with Doctrine 1.2 + MySQL 5. I created some phpunit's tests in few files. Every test create db and populate it - using Zend_Db - then I make some actions using Doctrine's models and then I drop db using Zend_Db. I put them all in directory called "tests". And when I go to directory "tests" and write phpunit command then some of them return errors like "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'here_db_name.here_table_name' doesn't exist". - but it exists, I checked! What is funny when I run every test separately then absolutly everything is ok. So, my question is: What's going on? Sorry, I can't provide code.

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

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

发布评论

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

评论(1

迷路的信 2024-10-15 16:30:14

在没有任何代码的情况下说这是很棘手的,但我在这里做出一个疯狂的猜测,如果你说每个测试都会创建并填充数据库,那么你遇到的可能是某种“竞争条件”,因为每个测试都会开始清理数据库然后再次设置。

This is tricky to say without any code but I am making a wild guess here that if you say that every test creates and populates the db it might be that what you are experiencing is some sort of a "race-condition" because each test starts with cleaning up the database and then setting it up again.

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