From ba821f663ea6b7f3cb51d93342142406895518aa Mon Sep 17 00:00:00 2001 From: Jonathan Hedstrom Date: Wed, 25 Mar 2015 14:51:54 -0700 Subject: [PATCH] Merge pull request #154 from dawehner/drupal-6 Register Drupal 6 core classes Signed-off-by: Jonathan Hedstrom --- .travis.yml | 13 ++++ behat.yml.dist | 23 ++++++++ features/d6.feature | 59 +++++++++++++++++++ .../modules/behat_test/behat_test.info | 3 + .../modules/behat_test/behat_test.install | 11 ++++ .../modules/behat_test/behat_test.module | 1 + .../config/drivers/drupal.yml | 9 +++ 7 files changed, 119 insertions(+) create mode 100644 features/d6.feature create mode 100644 fixtures/drupal6/modules/behat_test/behat_test.info create mode 100644 fixtures/drupal6/modules/behat_test/behat_test.install create mode 100644 fixtures/drupal6/modules/behat_test/behat_test.module diff --git a/.travis.yml b/.travis.yml index 31afe72b..65b17815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,17 @@ install: before_script: # Set sendmail so drush doesn't throw an error during site install. - echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'` + # Setup a stack Drupal 6 install to test api abilities. + - mysql -e 'create database drupal6' + - drush --quiet dl drupal-6 --drupal-project-rename=drupal6 + - drush --yes --root=$PWD/drupal6 site-install --db-url=mysql://travis:@127.0.0.1/drupal6 + - cp -r fixtures/drupal6/modules/behat_test drupal6/sites/all/modules + - cd drupal6 + - drush --yes en behat_test +# - drush --yes fr behat_test + - drush cc all + - drush --debug runserver :8886 > ~/debug6.txt 2>&1 & + - cd - # Setup a stock Drupal 7 install to test api abilities. - mysql -e 'create database drupal7' - drush --quiet dl drupal-7 --drupal-project-rename=drupal7 @@ -41,10 +52,12 @@ before_script: script: - vendor/bin/phpspec run -f pretty --no-interaction - vendor/bin/behat -fprogress --strict + - vendor/bin/behat -fprogress --profile=drupal6 --strict - vendor/bin/behat -fprogress --profile=drupal7 --strict - vendor/bin/behat -fprogress --profile=drush --strict - vendor/bin/behat -fprogress --profile=drupal8 --strict after_failure: + - cat ~/debug6.txt - cat ~/debug7.txt - cat ~/debug8.txt diff --git a/behat.yml.dist b/behat.yml.dist index 4994bbad..a377c94d 100644 --- a/behat.yml.dist +++ b/behat.yml.dist @@ -29,6 +29,29 @@ default: warning_message_selector: '.messages.warning' # Separate profile for testing using the api driver. This assumes a +# stock Drupal 6 install. +drupal6: + suites: + default: + contexts: + - FeatureContext + - Drupal\DrupalExtension\Context\DrupalContext + - Drupal\DrupalExtension\Context\MinkContext + - Drupal\DrupalExtension\Context\MarkupContext + filters: + tags: "@d6" + extensions: + Behat\MinkExtension: + base_url: http://localhost:8886 + Drupal\DrupalExtension: + api_driver: "drupal" + drupal: + # Change this to the absolute path to Drupal install. + drupal_root: "drupal6" + region_map: + left sidebar: "#sidebar-first" + content: "#content" +# Separate profile for testing using the api driver. This assumes a # stock Drupal 7 install. drupal7: suites: diff --git a/features/d6.feature b/features/d6.feature new file mode 100644 index 00000000..b79e7e1e --- /dev/null +++ b/features/d6.feature @@ -0,0 +1,59 @@ +@api @d6 +Feature: Environment check + + Scenario: Frontpage + Given I am not logged in + And I am on the homepage + Then I should see "User login" + + Scenario: assertAnonymousUser + Given I am an anonymous user + + @api + Scenario: assertAuthenticatedByRole + Given I am logged in as a user with the "authenticated" role + + @api + Scenario: assertAuthenticatedByRoleWithGivenFields + Given I am logged in as a user with the "authenticated" role and I have the following fields: + | name | test | + + @api + Scenario: createNode + Given I am viewing a story with the title "test" + Then I should see "test" + + @api + Scenario: createNodes + Given article content: + | title | author | status | created | + | My title | Joe Editor | 1 | 2014-10-17 8:00am | + When I am viewing a content with the title "My title" + Then I should see "My title" + + @api + Scenario: createTerm + Given I am viewing a tags term with the name "example tag" + Then I should see "example tag" + + @api + Scenario: createUsers + Given I am logged in as a user with the "administer users" permission + And users: + | name | mail | + | user foo | foo@bar.com | + | user bar | baz@bar.com | + When I visit "admin/user/user" + Then I should see "user foo" + And I should see "user bar" + + @api + Scenario: create node with terms. + Given tags terms: + | name | + | test-tag | + And article content: + | title | status | taxonomy | + | My title | 1 | test-tag | + When I am on the homepage + Then I should see "test-tag" diff --git a/fixtures/drupal6/modules/behat_test/behat_test.info b/fixtures/drupal6/modules/behat_test/behat_test.info new file mode 100644 index 00000000..3e0bc3fe --- /dev/null +++ b/fixtures/drupal6/modules/behat_test/behat_test.info @@ -0,0 +1,3 @@ +name = Behat test +description = Test feature exposing basic configuration for Behat Drupal extension test. +core = 6.x diff --git a/fixtures/drupal6/modules/behat_test/behat_test.install b/fixtures/drupal6/modules/behat_test/behat_test.install new file mode 100644 index 00000000..d0a0ede9 --- /dev/null +++ b/fixtures/drupal6/modules/behat_test/behat_test.install @@ -0,0 +1,11 @@ +