执行phpunit测试,报错

[root@localhost Api]# phpunit ./Api_User_Test.php

Fatal error: Uncaught Error: Call to undefined function DI() in /home/website/PhalApi/Demo/Tests/test_env.php:13
Stack trace:
#0 /home/website/PhalApi/Demo/Tests/Api/Api_User_Test.php(10): require_once()
#1 phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php(61): include_once('/home/website/P...')
#2 phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php(45): PHPUnit\Util\Fileloader::load('/home/website/P...')
#3 phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php(43): PHPUnit\Util\Fileloader::checkAndLoad('/home/website/P...')
#4 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(130): PHPUnit\Runner\StandardTestSuiteLoader->load('./Api_User_Test', '/home/website/P...')
#5 phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php(71): PHPUnit\Runner\BaseTestRunner->loadSuiteClass('./Api_User_Test', '/home/website/P...')
#6 phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php(161): PHPUnit\Runner\BaseTestRunner->getTest('./Api_User_Test', '/home/website/P...', Array)
#7 in /home/website/PhalApi/Demo/Tests/test_env.php on line 13
[root@localhost Api]# phpunit ./Api_User_Test.php

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in /home/website/PhalApi/Demo/Tests/Api/Api_User_Test.php on line 16
已邀请:

dogstar - PhalApi创始人

赞同来自:

错误1:你使用的框架版本是多少?DI() 函数是框架本身有的功能,应该不会出现这个错误的。或者你是不是修改过test_env.php文件?

错误2:你需要先安装:PHPUnit ,安装方法可在网上搜索一下。

要回复问题请先登录注册