yii2-app-basic icon indicating copy to clipboard operation
yii2-app-basic copied to clipboard

PHP Parse error

Open yambug opened this issue 2 years ago • 2 comments

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?

yambug avatar Aug 19 '22 13:08 yambug

How did you install the application?

  1. Try updating your PHP version.
  2. Try doing composer update.

samdark avatar Aug 19 '22 22:08 samdark

How did you install the application?

  1. Try updating your PHP version.
  2. Try doing composer update.

In my env,php version was 7.4,match the requirement;

and then,i run composer update,not work

yambug avatar Aug 20 '22 00:08 yambug

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.

samdark avatar Nov 18 '22 16:11 samdark