Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command "behat" is not defined #15

Open
ezenko opened this issue Dec 5, 2018 · 7 comments
Open

Command "behat" is not defined #15

ezenko opened this issue Dec 5, 2018 · 7 comments

Comments

@ezenko
Copy link

ezenko commented Dec 5, 2018

Both drush 9.5.2 and behat-drush-endpoint installed successfully, but command still not found.

Composer.json file:

{
    "name": "pantheon-systems/example-drops-8-composer",
    "description": "Install drops-8 with Composer on Pantheon.",
    "type": "project",
    "license": "MIT",
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "php": ">=7.0.8",
        "colours/atomic-design-access-control": "dev-master",
        "colours/codebeast": "dev-master",
        "colours/fancy-local-tasks": "dev-master",
        "colours/responsive-media-formatter": "dev-master",
        "composer/installers": "^1.0.20",
        "cweagans/composer-patches": "^1.0",
        "drupal-composer/drupal-scaffold": "^2.0.1",
        "drupal/admin_toolbar": "^1.25",
        "drupal/adminimal_admin_toolbar": "^1.8",
        "drupal/adminimal_theme": "^1.3",
        "drupal/checklistapi": "^1.8",
        "drupal/components": "^1.0",
        "drupal/config_direct_save": "^1.0",
        "drupal/config_installer": "^1.0",
        "drupal/config_update": "^1.5",
        "drupal/console": "^1",
        "drupal/contact_storage": "^1.0@beta",
        "drupal/core": "^8",
        "drupal/ctools": "^3.0",
        "drupal/devel": "^1.2",
        "drupal/diff": "^1.0@RC",
        "drupal/easy_breadcrumb": "^1.8",
        "drupal/embed": "^1.0",
        "drupal/entity_browser": "1.*",
        "drupal/entity_embed": "^1.0@beta",
        "drupal/field_group": "^1.0",
        "drupal/google_analytics": "^2.3",
        "drupal/htmlmail": "^2.64",
        "drupal/inline_entity_form": "^1.0@RC",
        "drupal/link_attributes": "^1.5",
        "drupal/linkit": "^4.3",
        "drupal/mailgun": "^1.0@beta",
        "drupal/mailsystem": "^4.1",
        "drupal/media_entity": "^1.8",
        "drupal/media_entity_document": "^1.1",
        "drupal/media_entity_download": "1.*",
        "drupal/media_entity_image": "^1.3",
        "drupal/media_entity_video": "^1.0@beta",
        "drupal/metatag": "^1.7",
        "drupal/nodeaccess": "^1.0@beta",
        "drupal/pathauto": "^1.3",
        "drupal/redirect": "^1.3",
        "drupal/seo_checklist": "^4.1",
        "drupal/simple_block": "^1.0@beta",
        "drupal/simple_revision": "^1.4",
        "drupal/simple_sitemap": "^2.12",
        "drupal/simplenews": "^1.0@alpha",
        "drupal/token": "^1.5",
        "drupal/twig_field_value": "^1.1",
        "drupal/video_embed_field": "^2.0",
        "drupal/webform": "^5.0@RC",
        "drush-ops/behat-drush-endpoint": "^9",
        "drush/drush": "~9",
        "pantheon-systems/quicksilver-pushback": "~1",
        "rvtraveller/qs-composer-installer": "^1.1",
        "solarium/solarium": "3.8.*",
        "webflo/drupal-core-strict": "^8"
    },
    "require-dev": {
        "mikey179/vfsstream": "^1.2",
        "behat/behat": "3.*",
        "behat/mink": "^1.7",
        "behat/mink-extension": "^2.2",
        "behat/mink-goutte-driver": "^1.2",
        "jcalderonzumba/gastonjs": "^1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "^0.3.1",
        "drupal/drupal-extension": "^3.1",
        "phpunit/phpunit": "^4.8",
        "symfony/css-selector": "^2.8"
    },
    "conflict": {
            "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "build-assets": [
            "@prepare-for-pantheon",
            "composer install --optimize-autoloader --no-dev"
        ],
        "lint": "find web/modules/custom web/themes/custom -name '*.php' -exec php -l {} \\;",
        "code-sniff": "echo 'No code sniff step defined.'",
        "unit-test": "echo 'No unit test step defined.'",
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "prepare-for-pantheon": "DrupalProject\\composer\\ScriptHandler::prepareForPantheon",
        "post-install-cmd": [
            "@drupal-scaffold",
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles",
            "find .circleci/scripts/pantheon/ -type f | xargs chmod 755",
            "find tests/scripts/ -type f | xargs chmod 755"
        ],
        "post-create-project-cmd": [
            "@drupal-scaffold",
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "web/core": ["type:drupal-core"],
            "web/modules/contrib/{$name}": ["type:drupal-module"],
            "web/profiles/contrib/{$name}": ["type:drupal-profile"],
            "web/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        },
        "build-env": {
            "install-cms": [
                "drush site-install standard --account-mail={account-mail} --account-name={account-name} --account-pass={account-pass} --site-mail={site-mail} --site-name={site-name} --yes",
                "drush pm-enable config_direct_save simple_block --yes",
                "drush pm-uninstall block_content --yes"
            ],
            "export-configuration": "drush config-export --yes"
        },
        "drupal-scaffold": {
            "source": "https://raw.githubusercontent.com/pantheon-systems/drops-8-scaffolding/{version}/{path}",
            "includes": [
                "sites/default/default.services.pantheon.preproduction.yml",
                "sites/default/settings.pantheon.php"
            ],
            "excludes": [
                ".csslintrc",
                ".editorconfig",
                ".eslintignore",
                ".eslintrc.json",
                ".htaccess",
                "web.config"
            ]
        }
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true,
        "platform": {
            "php": "7.0.8"
        }
    }
}

Drush version:
vendor/bin/drush --version Drush Commandline Tool 9.5.2

Error:
vendor/bin/drush behat Command "behat" is not defined.

@nielsonm
Copy link

I'm having a similar issue on my project.

However, I'm using drush 8.1.11.

I managed to get the behat command running after manually adding the path vendor/drush-ops/behat-drush-endpoint to vendor/drush/drush/lib/Drush/Boot/DrupalBoot.php->commandfile_searchpaths()

@greg-1-anderson
Copy link
Member

If you are using the 8.x / 9.x branches of this project (recommended), then you should be using Drush 8.2.3+ / Drush 9.6.2+, respectively.

@nielsonm
Copy link

@greg-1-anderson - thanks for the quick response! I'll upgrade versions of drush. Mind if I update the README to make that more explicit?

As a temporary workaround for the pre-8.2.3 crowd - I got it working locally by symlinking the composer installed path to the same directory as my project's drushrc.php file.

@greg-1-anderson
Copy link
Member

A PR with clarified documentation and workarounds would be appreciated.

@bserem
Copy link

bserem commented Jul 17, 2020

Not sure if it is related, but I get the same message when I try to add terms and/or content:

$ behat --profile local --format pretty --tags @failing
  @failing
  Scenario: Create a node                               # features/publisher_create_content.feature:43
    Given users:                                        # Drupal\DrupalExtension\Context\DrupalContext::createUsers()
      | name       | mail      | roles    |
      | Scarface | test@ex.con | publisher |
    Given "keywords" terms:                             # Drupal\DrupalExtension\Context\DrupalContext::createTerms()
      | name |
      | Dogs |
      | Cats |
      Command "behat" is not defined.  
                                         
      
       (RuntimeException)
    Given I am logged in as "Scarface"                  # Drupal\DrupalExtension\Context\DrupalContext::assertLoggedInByName()
    Given "article" content:                             # Drupal\DrupalExtension\Context\DrupalContext::createNodes()
      | title        | keywords | status | author   |
      | Best Buddies | Dogs     | 0      | Scarface |
    When I go to "admin/content"                        # Drupal\DrupalExtension\Context\MinkContext::visit()
    Then I should see "Best Buddies"                    # Drupal\DrupalExtension\Context\MinkContext::assertPageContainsText()
    When I click "Best Buddies"                         # Drupal\DrupalExtension\Context\MinkContext::assertClick()
    Then I should see "Dogs" in the "content" region    # Drupal\DrupalExtension\Context\MinkContext::assertRegionText()
    And I should not see "Cats" in the "content" region # Drupal\DrupalExtension\Context\MinkContext::assertNotRegionText()
    And I should see "Cats" in the "sidebar" region     # Drupal\DrupalExtension\Context\MinkContext::assertRegionText()

--- Failed scenarios:

    features/publisher_create_content.feature:43

1 scenario (1 failed)
10 steps (1 passed, 1 failed, 8 skipped)
0m10.86s (15.41Mb)

I can create users and clear cache, but I can't create content or terms. I get the Command "behat" is not defined. error above.

Terms:
image

Content:
image

Users:
image

@samiullah
Copy link

Facing same issue as #15 (comment)

@uceap-web
Copy link

Installing composer require drush-ops/behat-drush-endpoint:^9 fixed the issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants