PHP +用于单元测试的 HSQLDB
有没有办法运行hsqldb等内存数据库?
我需要它来进行单元测试。在Java中没有问题。但不幸的是,PHP 中存在一个问题。那么,有办法吗?
Is there a way to run in-memory database such as hsqldb?
I need it for unit testing. In Java there's no problem with it. But, unfortunately, there is a problem with it in PHP. So, is there a way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够使用此 Perl 模块通过 PHP
https://metacpan.org/pod/ 访问 HSQLDB DBD::JDBC
You should be able to use this Perl module to access HSQLDB via PHP
https://metacpan.org/pod/DBD::JDBC
理想情况下,对于单元测试,您应该模拟数据访问,以便单独测试组件 - 因此您可以使用模拟和存根来消除测试中对数据库的依赖。
Ideally for unit testing you should be mocking your data access in order to test your components in isolation - so you would use mocks and stubs to remove the dependency on the database in your tests.