1
votes

I am trying to setting up Codeception with Yii2 Basic framework. Unit Test's are working fine. Acceptance is also working, but if I want to use WebDriver module, I get error. This is the acceptance.suite.yml file

class_name: AcceptanceTester
modules:
    enabled:
      - AcceptanceHelper
      - WebDriver:
         url: 'http://mylocalsite'
         browser: phantomjs 

Phantomjs is installed and running on PORT 4444.

The error I get is:

[yii\base\ErrorException]
Illegal offset type in isset or empty

This is the composer file to give you idea about versions.

{
    "config": {
        "vendor-dir": "protected/vendor"
    },

  "require": {
    "yiisoft/yii2": ">=2.0.5",
    "yiisoft/yii2-bootstrap": "*",
    "yiisoft/yii2-swiftmailer": "*",

    "guzzlehttp/guzzle": "4.*",
    "mobiledetect/mobiledetectlib" : "2.8.8",
    "codeception/codeception": "2.0.16",
    "codeception/specify": "*",
    "codeception/verify": "*",
    "yii2tech/sitemap": "*",
    "geoip2/geoip2":"~2.0",
    "facebook/facebook-instant-articles-sdk-php": "^1.5"
  },
  "require-dev": {
    "yiisoft/yii2-codeception": "*",
    "yiisoft/yii2-composer": "*",
    "yiisoft/yii2-debug": "*",
    "yiisoft/yii2-gii": "*",
    "yiisoft/yii2-faker": "*"
  },
}

Is there any wrong with the configuration file or anyone face the same issue?

1

1 Answers

3
votes

The following is just an assumption and is not verified. YAML configuration in old Codeception version was slightly different, AFAIK there was an additional config section. Your composer.json shows that you manually locked to "codeception/codeception": "2.0.16".

What you could try:

Update to 2.2

  • using "codeception/codeception": "^2.2" in composer.json

Provide additional config section

class_name: AcceptanceTester
modules:
  enabled:
    - WebDriver
  config:
    WebDriver:
      url: http://mylocalsite
      browser: phantomjs
      port: 4444