yii2-app-basic
yii2-app-basic copied to clipboard
PHP Parse error
What steps will reproduce the problem?
console run: vendor/bin/codecept run unit
What's expected?
codeception not work
What do you get instead?
PHP Parse error: syntax error, unexpected ')', expecting '|' or variable (T_VARIABLE) in /home/yambo/WorkSpace/yii2-app-basic/vendor/symfony/console/Application.php on line 232
Additional info
Q | A |
---|---|
Yii version | 2.0.45 |
PHP version | 7.4 |
Operating system | ubuntu 22 |
the error occur in yii2-app-basic tag:2.0.46
and yii2-app-basic tag:2.0.45 seems not better:
yambo@yambo-ThinkPad-T480s:~/WorkSpace/yii2-app-basic-2.0.45$ vendor/bin/codecept run api
Codeception PHP Testing Framework v4.2.2 https://helpukrainewin.org
Powered by PHPUnit 8.5.28 #StandWithUkraine
Api Tests (1) ------------------------------------------------------------------
E demoCest: Try to test (0.00s)
--------------------------------------------------------------------------------
Time: 115 ms, Memory: 8.00 MB
There was 1 error:
---------
1) demoCest: Try to test
Test tests/api/demoCest.php:tryToTest
PHP Parse error: syntax error, unexpected 'static' (T_STATIC) in /home/yambo/WorkSpace/yii2-app-basic-2.0.45/vendor/symfony/string/UnicodeString.php on line 44
the test case is :
<?php
class demoCest
{
public function _before(ApiTester $I)
{
}
// tests
public function tryToTest(ApiTester $I)
{
$I->sendPOST('',['page'=>1,'ter_account'=>1]);
$I->seeResponseCodeIs(\Codeception\Util\HttpCode::OK); // 200
$I->seeResponseIsJson();
// $I->seeResponseContains('"code":1');
$I -> seeResponseContainsJson( ['code'=>1] );
}
}
configs:
actor: ApiTester
modules:
enabled:
- \Helper\Api
and codeception config:
actor: Tester
bootstrap: _bootstrap.php
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
memory_limit: 1024M
colors: true
modules:
config:
Yii2:
configFile: 'config/test.php'
Is there something I'm doing wrong?
How did you install the application?
- Try updating your PHP version.
- Try doing
composer update
.
How did you install the application?
- Try updating your PHP version.
- Try doing
composer update
.
In my env,php version was 7.4,match the requirement;
and then,i run composer update
,not work
That's because I've built with 8.0 last time so zip contained libraries that match it. Will build with 7.4 this time.