Skip to content

Commit

Permalink
Merge pull request #154 from dawehner/drupal-6
Browse files Browse the repository at this point in the history
Register Drupal 6 core classes

Signed-off-by: Jonathan Hedstrom <[email protected]>
  • Loading branch information
jhedstrom committed Mar 25, 2015
1 parent e590e37 commit ba821f6
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
23 changes: 23 additions & 0 deletions behat.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
59 changes: 59 additions & 0 deletions features/d6.feature
Original file line number Diff line number Diff line change
@@ -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"
3 changes: 3 additions & 0 deletions fixtures/drupal6/modules/behat_test/behat_test.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name = Behat test
description = Test feature exposing basic configuration for Behat Drupal extension test.
core = 6.x
11 changes: 11 additions & 0 deletions fixtures/drupal6/modules/behat_test/behat_test.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

/**
* Implements hook_install().
*/
function behat_test_install() {
$edit = array();
$edit['name'] = 'tags';
$edit['help'] = '';
taxonomy_save_vocabulary($edit);
}
1 change: 1 addition & 0 deletions fixtures/drupal6/modules/behat_test/behat_test.module
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ parameters:
drupal.random.class: Drupal\Component\Utility\Random

# Core controllers.
drupal.driver.cores.6.class: Drupal\Driver\Cores\Drupal6
drupal.driver.cores.7.class: Drupal\Driver\Cores\Drupal7
drupal.driver.cores.8.class: Drupal\Driver\Cores\Drupal8

Expand All @@ -19,6 +20,14 @@ services:
- @drupal.driver.random
tags:
- { name: drupal.driver, alias: drupal }
drupal.driver.cores.6:
class: %drupal.driver.cores.6.class%
tags:
- { name: drupal.core, alias: 6 }
arguments:
- %drupal.driver.drupal.drupal_root%
- %mink.base_url%
- @drupal.driver.random
drupal.driver.cores.7:
class: %drupal.driver.cores.7.class%
tags:
Expand Down

0 comments on commit ba821f6

Please sign in to comment.