我们如何从脚本中运行civicrm的单元测试?

时间:2017-06-06 09:20:29

标签: phpunit xdebug civicrm

我执行此命令行来运行单元测试:

  

hatem.hadrich@pc_Hatem_Hadrich:/ projet / tools $ php / scripts / phpunit CRM_AllTests

当我从本地实例运行单元测试时遇到此错误,我找不到解决方法,任何人都可以帮我修复此错误。

PHP Fatal error:  Class 'CiviTestSuite' not found in /projet/../civicrm/tests/phpunit/CRM/AllTests.php on line 39
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/local/bin/phpunit:569
PHP   3. PHPUnit_TextUI_Command->run() 
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:115
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() 
phar:///usr/local/bin/phpunit/phpunit/TextUI/Command.php:137
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() 
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:65
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() 
phar:///usr/local/bin/phpunit/phpunit/Runner/BaseTestRunner.php:124
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() phar:///usr/local/bin/phpunit/phpunit/Runner/StandardTestSuiteLoader.php:39
PHP   8. PHPUnit_Util_Fileloader::load() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:38
PHP   9. include_once() phar:///usr/local/bin/phpunit/phpunit/Util/Fileloader.php:56

1 个答案:

答案 0 :(得分:0)

我找到了修复此错误的方法,您必须在CiviTest中使用require_one作为引导程序文件:

.{"+i+"}