php - Which version of PHPUnit is suitable to test code PHP version 5.5.9?
问题描述
I have to test php code version 5.5.9 with PHPUnit. Which version is suitable for this purpose?
I'm using PHPUnit 4.8, that require PHP 5.3, and get the following error for a test:
PHP Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR)
PHP Stack trace:
PHP 1. {main}() /home/foo/.phpstorm_helpers/phpunit.php:0
PHP 2. IDE_Base_PHPUnit_TextUI_Command::main($exit = *uninitialized*)
According to this Q/A PHPUnit 3.6 PHP 5.2.7 PHP Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /usr/local/bin/phpunit on line 16 PHPUnit version cause the error.
I read here https://phpunit.de/manual/5.0/en/installation.html that PHPUnit version 5.0 require PHP 5.6 (so not a good choice for my case).
Which version of PHPUnit should I install to avoid this error?
UPDATE: the error does not arise since I added this line in composer.json :
"require-dev": {
"phpunit/phpunit": "^4"
}
Thank you
解决方案
You can find the information you are looking for here.
推荐阅读
- angular - 测试 Angular 组件时未定义 NgZone
- c# - 找不到 Visual Studio GTK GUI 设计器/源按钮
- javascript - 如何测试 vue.js v-select 组件的值
- c - 没有正确读取数字?
- dart - 向左或向右滑动以选择 (Flutter)
- mysql - MYSQL - 创建具有多个表的视图
- html - HTML 电子邮件 - 在已定义宽度和高度的元素内居中图像
- python - 如何在模板匹配中使用 cv2.minMaxLoc()
- asp.net-mvc - 使用 WebAPI 进行基于令牌的身份验证来验证 MVC 和移动应用程序
- python - 寻找 Pandas.DateTimeIndex.is_dst()