Ошибка проверки Behat после обновления до Behat 3.3.1 - Слишком мало аргументов для функции FeatureContext - PullRequest
0 голосов
/ 23 апреля 2019

Я обновляю свой сайт на 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;
  }

Вот мой беат.имл

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

1 Ответ

0 голосов
/ 03 мая 2019

Оказалось, часть моей конфигурации отсутствовала в файле behat.yml.

Часть отсутствовала:

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