Skip to content

Commit 572d166

Browse files
authored
Merge pull request #586 from jhedstrom/585-fix-travis
585: Fix travis.
2 parents ed96cd1 + 1c62445 commit 572d166

File tree

42 files changed

+1135
-68
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1135
-68
lines changed

.travis.yml

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
language: php
22

33
php:
4-
- 7.1
5-
- 7.2
64
- 7.3
5+
- 7.4
76

87
env:
98
global:
@@ -12,6 +11,7 @@ env:
1211
matrix:
1312
- DRUPAL_VERSION=7
1413
- DRUPAL_VERSION=8
14+
- DRUPAL_VERSION=9
1515

1616
# Enable Travis containers.
1717
sudo: false
@@ -26,37 +26,36 @@ install:
2626
# @see https://github.com/jhedstrom/drupalextension/issues/413
2727
# @todo Re-enable behat drush endpoint testing.
2828
# @see https://github.com/jhedstrom/drupalextension/issues/458
29-
- test ${DRUPAL_VERSION} -ne 8 || COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require drush/drush:~10.0 symfony/dependency-injection:3.4.4
29+
- test ${DRUPAL_VERSION} -lt 8 || composer require --no-interaction --dev --no-update drupal/core-recommended:^${DRUPAL_VERSION} drupal/core-composer-scaffold:^${DRUPAL_VERSION} drush/drush:^10
30+
# Remove core/drush deps for Drupal 7.
31+
- test ${DRUPAL_VERSION} -ge 8 || composer remove --dev drush/drush drupal/core-recommended drupal/core-composer-scaffold
3032
- composer install
3133
# For Drupal 8, change composer.json to require symfony 3.x as conflicting
3234
# versions between the separate drupal and drupalextension vendor folders
3335
# can create conflicts.
34-
# @todo Change test process to require drupalextension from the local folder
35-
# to let composer handle compatibility and simulate a more common process.
36-
- test ${DRUPAL_VERSION} -ne 8 || COMPOSER_MEMORY_LIMIT=-1 travis_retry composer require "symfony/browser-kit:~3.4" "symfony/dependency-injection:~3.0" "symfony/translation:^3.4"
3736
# Install drush globally.
38-
- (test ${DRUPAL_VERSION} -ne 8 && composer global require drush/drush:~8.0 drupal/drupal-driver) || composer global require drush/drush:~10.0
37+
- (test ${DRUPAL_VERSION} -lt 8 && composer global require drush/drush:~8.0 drupal/drupal-driver) || composer global require drush/drush:~10.0
3938
# Install the Behat Drush Endpoint for Drupal 7 tests.
40-
- test ${DRUPAL_VERSION} -ne 7 || (git clone https://github.com/drush-ops/behat-drush-endpoint.git drush/behat-drush-endpoint && (cd drush/behat-drush-endpoint && composer install && cd -))
39+
- test ${DRUPAL_VERSION} -gt 7 || (git clone https://github.com/drush-ops/behat-drush-endpoint.git drush/behat-drush-endpoint && (cd drush/behat-drush-endpoint && composer install --no-dev && cd -))
4140
# Pin node version.
4241
# @see http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
4342
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
4443
- npm install
4544

4645
before_script:
4746
# Define the module path according to the Drupal version being tested.
48-
- test ${DRUPAL_VERSION} -ne 8 || export MODULE_PATH="drupal/modules"
49-
- test ${DRUPAL_VERSION} -eq 8 || export MODULE_PATH="drupal/sites/all/modules" && mkdir -p ${MODULE_PATH}
47+
- test ${DRUPAL_VERSION} -lt 8 || export MODULE_PATH="drupal/modules"
48+
- test ${DRUPAL_VERSION} -ge 8 || export MODULE_PATH="drupal/sites/all/modules" && mkdir -p ${MODULE_PATH}
5049
# Set sendmail so drush doesn't throw an error during site install.
5150
- echo "sendmail_path='true'" >> `php --ini | grep "Loaded Configuration" | awk '{print $4}'`
5251
- mysql -e 'create database drupal'
5352
# Download and install Drupal so we can test API abilities.
5453
# For Drush 9, dl is deprecated so we must use composer. However, we still
5554
# cannot simply require drupal/drupal since it hardcodes it's autoloader
5655
# and we'd need to use drupal-scaffold, etc, etc.
57-
- test ${DRUPAL_VERSION} -eq 8 || drush dl --quiet --yes drupal-${DRUPAL_VERSION}.x --all --drupal-project-rename=drupal
58-
- test ${DRUPAL_VERSION} -ne 8 || (mkdir -p tmp && cd tmp && composer require --no-interaction drupal/drupal && cd - && rm -rf drupal && mv tmp/vendor/drupal/drupal ./drupal && cd drupal && composer install && cd - && rm -rf tmp)
59-
- drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal
56+
- test ${DRUPAL_VERSION} -ge 8 || drush dl --quiet --yes drupal-${DRUPAL_VERSION}.x --all --drupal-project-rename=drupal
57+
# Install Drupal.
58+
- drush --yes --root=$PWD/drupal site-install --db-url=mysql://travis:@127.0.0.1/drupal --debug
6059
# Copy the static HTML that is used for blackbox testing in the web root.
6160
- cp -r fixtures/blackbox $PWD/drupal
6261
# Copy our test module to the correct location.
@@ -70,11 +69,11 @@ before_script:
7069
# Only revert features on Drupal 7.
7170
- test \! ${DRUPAL_VERSION} -eq 7 || drush --yes fr behat_test
7271
# Disable the page cache on Drupal 8.
73-
- test \! ${DRUPAL_VERSION} -eq 8 || drush --yes pmu page_cache
72+
- test \! ${DRUPAL_VERSION} -ge 8 || drush --yes pmu page_cache
7473
# Test with big_pipe enabled for Drupal 8.
75-
- test \! ${DRUPAL_VERSION} -eq 8 || drush --yes en -y big_pipe
74+
- test \! ${DRUPAL_VERSION} -ge 8 || drush --yes en -y big_pipe
7675
# Clear the cache on Drupal 6 and 7, rebuild on Drupal 8.
77-
- test ${DRUPAL_VERSION} -eq 8 && drush cr || drush cc all || true
76+
- test ${DRUPAL_VERSION} -ge 8 && drush cr || drush cc all || true
7877
- drush --debug runserver :8888 > ~/debug.txt 2>&1 &
7978
- cd -
8079
- sleep 4s

behat.yml.dist

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ default:
3030
warning_message_selector: '.messages.warning'
3131

3232
# Separate profile for testing using the api driver. This assumes a
33-
# stock Drupal 6 install.
34-
drupal6:
33+
# stock Drupal 7 install.
34+
drupal7:
3535
suites:
3636
default:
3737
contexts:
@@ -40,7 +40,7 @@ drupal6:
4040
- Drupal\DrupalExtension\Context\MinkContext
4141
- Drupal\DrupalExtension\Context\MarkupContext
4242
filters:
43-
tags: "@d6"
43+
tags: "@d7"
4444
extensions:
4545
Drupal\MinkExtension:
4646
base_url: http://127.0.0.1:8888
@@ -52,57 +52,64 @@ drupal6:
5252
region_map:
5353
left sidebar: "#sidebar-first"
5454
content: "#content"
55-
# Separate profile for testing using the api driver. This assumes a
56-
# stock Drupal 7 install.
57-
drupal7:
55+
56+
# Separate profile for testing using the Drush driver. Assumes a stock
57+
# Drupal 7 install.
58+
drush:
5859
suites:
5960
default:
6061
contexts:
6162
- FeatureContext
6263
- Drupal\DrupalExtension\Context\DrupalContext
64+
- Drupal\DrupalExtension\Context\DrushContext
6365
- Drupal\DrupalExtension\Context\MinkContext
6466
- Drupal\DrupalExtension\Context\MarkupContext
6567
filters:
66-
tags: "@d7"
68+
tags: "@drushTest"
6769
extensions:
6870
Drupal\MinkExtension:
6971
base_url: http://127.0.0.1:8888
7072
Drupal\DrupalExtension:
71-
api_driver: "drupal"
72-
drupal:
73-
# Change this to the absolute path to Drupal install.
74-
drupal_root: "drupal"
73+
api_driver: "drush"
74+
drush_driver: "drush"
75+
drush:
76+
root: "drupal"
7577
region_map:
7678
left sidebar: "#sidebar-first"
7779
content: "#content"
7880

79-
# Separate profile for testing using the Drush driver. Assumes a stock
80-
# Drupal 7 install.
81-
drush:
81+
# Separate profile for testing D8. Assumes a stock Drupal 8 install.
82+
drupal8:
8283
suites:
8384
default:
8485
contexts:
8586
- FeatureContext
87+
- Drupal\DrupalExtension\Context\ConfigContext
8688
- Drupal\DrupalExtension\Context\DrupalContext
87-
- Drupal\DrupalExtension\Context\DrushContext
8889
- Drupal\DrupalExtension\Context\MinkContext
8990
- Drupal\DrupalExtension\Context\MarkupContext
91+
- Drupal\DrupalExtension\Context\MessageContext
92+
- Drupal\DrupalExtension\Context\MailContext
93+
- Drupal\DrupalExtension\Context\RandomContext
9094
filters:
91-
tags: "@drushTest"
95+
tags: "@d8&&~@d8wip"
9296
extensions:
9397
Drupal\MinkExtension:
9498
base_url: http://127.0.0.1:8888
9599
Drupal\DrupalExtension:
96-
api_driver: "drush"
97-
drush_driver: "drush"
98-
drush:
99-
root: "drupal"
100+
api_driver: "drupal"
101+
drupal:
102+
# Change this to the absolute path to Drupal install.
103+
drupal_root: "drupal"
100104
region_map:
101105
left sidebar: "#sidebar-first"
102106
content: "#content"
107+
selectors:
108+
error_message_selector: '.messages--error'
103109

104-
# Separate profile for testing D8. Assumes a stock Drupal 8 install.
105-
drupal8:
110+
# Separate profile for testing D9. Assumes a stock Drupal 9 install.
111+
# This uses the same tags as Drupal 8.
112+
drupal9:
106113
suites:
107114
default:
108115
contexts:

composer.json

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"homepage": "https://github.com/pfrenssen"
2020
}
2121
],
22-
"minimum-stability": "dev",
2322
"prefer-stable": true,
2423
"require": {
2524
"behat/behat": "~3.2",
@@ -33,9 +32,13 @@
3332
"symfony/translation": "^3.4|~4.4"
3433
},
3534
"require-dev": {
36-
"phpspec/phpspec": "~2.0 || ~4.0",
35+
"composer/installers": "^1.2",
36+
"drupal/coder": "^8.3",
37+
"drupal/core-composer-scaffold": "^9.1",
38+
"drupal/core-recommended": "^9.1",
39+
"drush/drush": "^10.5",
3740
"jakub-onderka/php-parallel-lint": "^0.9.2",
38-
"drupal/coder": "^8.3"
41+
"phpspec/phpspec": "^4.0 || ^6.0"
3942
},
4043
"scripts": {
4144
"test": [
@@ -58,6 +61,16 @@
5861
"extra": {
5962
"branch-alias": {
6063
"dev-master": "4.1.x-dev"
64+
},
65+
"installer-paths": {
66+
"drupal/core": [
67+
"type:drupal-core"
68+
]
69+
},
70+
"drupal-scaffold": {
71+
"locations": {
72+
"web-root": "drupal/"
73+
}
6174
}
62-
}
75+
}
6376
}

fixtures/drupal6/modules/behat_test/behat_test.info

Lines changed: 0 additions & 3 deletions
This file was deleted.

fixtures/drupal6/modules/behat_test/behat_test.install

Lines changed: 0 additions & 16 deletions
This file was deleted.

fixtures/drupal6/modules/behat_test/behat_test.module

Lines changed: 0 additions & 6 deletions
This file was deleted.

fixtures/drupal8/modules/behat_test/behat_test.info.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ name: Behat test
22
type: module
33
description: 'Test feature exposing basic configuration for Behat Drupal extension test.'
44
package: Test
5-
core: '8.x'
5+
core_version_requirement: ^8 || ^9
66
dependencies:
77
- language
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: Behat test
2+
type: module
3+
description: 'Test feature exposing basic configuration for Behat Drupal extension test.'
4+
package: Test
5+
core_version_requirement: ^8 || ^9
6+
dependencies:
7+
- language
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* @file
5+
* Install hooks for the behat_test module.
6+
*/
7+
8+
/**
9+
* Implements hook_install().
10+
*/
11+
function behat_test_install() {
12+
$storage = \Drupal::service('behat_test.config.storage.install');
13+
14+
// Override Standard profile's user settings with our own.
15+
$config_names = [
16+
'core.entity_form_mode.user.register',
17+
'core.entity_form_display.user.user.default',
18+
'core.entity_view_display.user.user.default',
19+
'core.entity_view_display.user.user.compact',
20+
'core.entity_view_mode.user.compact',
21+
'core.entity_view_mode.user.full',
22+
];
23+
24+
foreach ($config_names as $config_name) {
25+
$data = $storage->read($config_name);
26+
\Drupal::configFactory()->getEditable($config_name)->setData($data)->save();
27+
}
28+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
services:
2+
behat_test.config.storage.install:
3+
class: Drupal\behat_test\Config\BehatTestExtensionInstallStorage
4+
arguments: ['@config.storage', 'config/install', '', true, '%install_profile%']

0 commit comments

Comments
 (0)