升级到 Behat 3.3.1 后 Behat 测试错误 - 功能 FeatureContext 的参数太少

Behat test error after upgrade to Behat 3.3.1 - Too few arguments to function FeatureContext

我正在将我的 Drupal 8 站点升级到 8.4.8,它会自动升级到 3.3.1

我刚刚发现我的 Behat 测试不再有效,并卡在以下错误中。

这里是错误

ArgumentCountError: Too few arguments to function Drupal\FeatureContext::__construct(), 0 passed and exactly 1 expected in /var/www/mywebsite/tests/behat/features/bootstrap/Drupal/FeatureContext.php

这是我在 FeatureContext.php 文件

中的构造函数
/**
 * FeatureContext class defines custom step definitions for Behat.
 */
class FeatureContext extends PageObjectContext implements SnippetAcceptingContext {

  private $fourZeroFour;

  public function __construct(FourZeroFour $fourZeroFour) {
    $this->fourZeroFour = $fourZeroFour;
  }

这是我的 behat.yml

imports:
  - behat.yml

local:
  suites:
    default:
      paths:
        # Set features to repo root so that .feature files belonging to contrib
        # modules, themes, and profiles can be discovered.
        features: /var/www/mywebsite
        bootstrap: /var/www/mywebsite/tests/behat/features/bootstrap
      contexts:
        - Drupal\FeatureContext:
          parameters:
            environment:
              # absolute path to local directory to store screenshots - do not include trailing slash
              screenshot_dir: /var/www/mywebsite/reports
        - Drupal\DrupalExtension\Context\DrupalContext
        - Drupal\DrupalExtension\Context\MinkContext
        - Drupal\DrupalExtension\Context\MessageContext
        - Drupal\DrupalExtension\Context\DrushContext

事实证明,behat.yml 文件中缺少我的部分配置。

部分缺失:

SensioLabs\Behat\PageObjectExtension:
  namespaces:
    page: Page
    element: Page\Element