gpt4 book ai didi

PHP fatal error : Class 'WP_UnitTestCase' not found when trying to run test-sample

转载 作者:行者123 更新时间:2023-12-04 17:35:41 24 4
gpt4 key购买 nike

我正在尝试使用 phpunit 通过我的 wordpress 插件初始化 php 单元测试。我在 Windows 上运行 xampp。如果这有什么不同的话,我的 xampp 安装也在我的 E: 驱动器上。我正在学习本教程:

https://www.smashingmagazine.com/2017/12/automated-testing-wordpress-plugins-phpunit/

我已经到了我要跑的地方了

install-wp-tests.sh wordpress_test root '' localhost latest

我运行它,它弹出并快速关闭,所以我不知道它是否真的有效。然后我尝试运行

phpunit tests/test-sample.php

我得到:

PHP Fatal error:  Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11

Fatal error: Class 'WP_UnitTestCase' not found in E:\xampp\htdocs\wp-content\plugins\SRBC\tests\test-sample.php on line 11

我认为这意味着 install-wp-test.sh 没有正确安装并且缺少那些类。有什么想法吗?

最佳答案

最终需要为 Windows 安装 SVN。还必须将 mysqladmin.exe 路径添加到 PATH 环境变量。然后终于需要这个:

https://wordpress.stackexchange.com/questions/249402/error-when-setting-up-phpunit-tests-with-wp-cli-scaffold

毕竟还有 3 个小时!我让它正常工作!

希望这对其他人有帮助。

关于PHP fatal error : Class 'WP_UnitTestCase' not found when trying to run test-sample,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56763165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com