php - PHPUnit 继承测试
问题描述
我有一个父类和一个子类 - 加载了 spl_register_autoload()) 并且我正在尝试编写 PHPUnit 测试;我的继承有问题:当我运行测试时,会出现以下警告消息:
Warning: include(classes/PHPUnit\Composer\Autoload\ClassLoader.class.php): failed to open stream: No such file or directory in C:\wamp64\www\test\test\unit_tests\test\Employe9Test.php on line 36.
任何想法?
解决方案
从 Employe9Test.php 调用文件时找不到 ClassLoader.class.php 的相对路径
如果您的测试需要自动加载器,我可以建议您使用 phpunit 配置文件中的 bootstrap 属性吗?
<phpunit bootstrap="src/autoload.php">
<testsuites>
<testsuite name="money">
<file>tests/IntlFormatterTest.php</file>
<file>tests/MoneyTest.php</file>
<file>tests/CurrencyTest.php</file>
</testsuite>
</testsuites>
</phpunit>
这样,如果自动加载文件路径发生变化,您就不必在每个测试文件中调整/编辑自动加载文件路径。
推荐阅读
- c# - Raspberry Pi 与 Win10 IoT 和 Xamarin Android 应用程序之间的 TCP 通信
- angular - 将 Angular 2 网站部署到 EcoWebhosting
- reactjs - ref 按钮的 clientWidth 属性返回 undefined
- c++ - 在 OpenCV FOURCC 编解码器中编写视频
- ios - 在 swift 中为选项创建 JSON
- c++ - 矩阵乘法性能,int vs double
- php - 比较两个字符串是否具有相似性
- mysql - Node JS 等待一系列 mysql 查询
- python - 删除 datalist Python 2.7/Django 中的重复项
- spacy - Spacy - 英语语言模型在德语文本上超过德语语言模型?