File tree Expand file tree Collapse file tree 7 files changed +59
-26
lines changed Expand file tree Collapse file tree 7 files changed +59
-26
lines changed Original file line number Diff line number Diff line change @@ -82,13 +82,10 @@ Use the `ddev core-version` command to set the core version environment variable
82
82
ddev core-version ^11
83
83
```
84
84
85
- You can also do this manually:
85
+ You can also do this manually by setting a version in ` .ddev/.env ` :
86
86
87
- In ` .ddev/config.local.yaml ` set the Drupal core version:
88
-
89
- ``` yaml
90
- web_environment :
91
- - DRUPAL_CORE=^11
87
+ ``` ini
88
+ DRUPAL_CORE =^11
92
89
```
93
90
94
91
Then run ` ddev restart ` and then ` ddev poser ` to update the Drupal core version.
Original file line number Diff line number Diff line change 8
8
9
9
set -eu -o pipefail
10
10
11
- # Handle when config.local.yaml doesn't exist, or has no web_environment key.
12
- if [[ ! -f .ddev/config.local.yaml || ! ` grep ' ^web_environment:' .ddev/config.local.yaml` ]]; then
13
- echo -e " web_environment:\n - DRUPAL_CORE=$1 " >> .ddev/config.local.yaml
14
- # Handle when we have a DRUPAL_CORE env var already.
15
- elif [[ ` grep ' DRUPAL_CORE=' .ddev/config.local.yaml` ]]; then
16
- sed -ri " s/^(\s+)- DRUPAL_CORE=.*/\1- DRUPAL_CORE=$1 /" .ddev/config.local.yaml
17
- # Handle when we do not have a DRUPAL_CORE env var already.
18
- else
19
- # Additionally handle if web_environment is set to an empty array.
20
- sed -ri " s/web_environment:\s+\[\s*\]/web_environment:/" .ddev/config.local.yaml
21
- sed -i " /web_environment:/a \ \ - DRUPAL_CORE=$1 " .ddev/config.local.yaml
11
+ # Handle default values.
12
+ DRUPAL_CORE=${1:- default}
13
+ if [ " $DRUPAL_CORE " == " default" ]; then
14
+ DRUPAL_CORE=" "
22
15
fi
23
16
17
+ # Set/clear the env.
18
+ ddev dotenv set .ddev/.env --drupal-core " ${DRUPAL_CORE} "
19
+
20
+ # Restart and rebuild.
24
21
ddev restart
25
22
ddev poser
Original file line number Diff line number Diff line change 10
10
11
11
set -eu -o pipefail
12
12
13
+ # Set the default core version.
14
+ export DRUPAL_CORE=${DRUPAL_CORE:- ^11}
15
+
13
16
export _WEB_ROOT=$DDEV_DOCROOT
14
17
cd " $DDEV_COMPOSER_ROOT " || exit
15
18
curl -OL https://git.drupalcode.org/project/gitlab_templates/-/raw/default-ref/scripts/expand_composer_json.php
Original file line number Diff line number Diff line change 5
5
web_environment :
6
6
# To change the Drupal core version, see the README:
7
7
# https://github.com/ddev/ddev-drupal-contrib/blob/main/README.md#changing-the-drupal-core-version
8
- - DRUPAL_CORE=^11
9
- - # https://git.drupalcode.org/project/gitlab_templates/-/blob/1.9.6/scripts/expand_composer_json.php?ref_type=tags#L15
8
+ # https://git.drupalcode.org/project/gitlab_templates/-/blob/1.9.6/scripts/expand_composer_json.php?ref_type=tags#L15
10
9
- IGNORE_PROJECT_DRUPAL_CORE_VERSION=1
11
10
# To change the location of your project code, see the README:
12
11
# https://github.com/ddev/ddev-drupal-contrib/blob/main/README.md#changing-the-symlink-location
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ _common_setup() {
13
13
cd ${TESTDIR}
14
14
ddev config --project-name=${PROJNAME} --project-type=drupal --docroot=web --php-version=8.3 --corepack-enable
15
15
if [ -n " $TEST_DRUPAL_CORE " ] && [ " $TEST_DRUPAL_CORE " != " default" ]; then
16
- echo -e " web_environment:\n - DRUPAL_CORE= ^${TEST_DRUPAL_CORE} " > .ddev/config.~overrides.yaml
16
+ ddev dotenv set .ddev/.env --drupal-core " ^${TEST_DRUPAL_CORE} "
17
17
fi
18
18
ddev add-on get ddev/ddev-selenium-standalone-chrome
19
19
ddev add-on get ${DIR}
Original file line number Diff line number Diff line change
1
+ load helpers/bats-support/load.bash
2
+ load helpers/bats-assert/load.bash
3
+
4
+ setup_file () {
5
+ if [ -n " $TEST_DRUPAL_CORE " ] && [ " $TEST_DRUPAL_CORE " != " default" ]; then
6
+ skip " TEST_DRUPAL_CORE=$TEST_DRUPAL_CORE not handled by this test suite" >&2
7
+ fi
8
+ load ' _common.bash'
9
+ _common_setup
10
+ ddev start
11
+ _common_test_poser
12
+ }
13
+
14
+ teardown_file () {
15
+ load ' _common.bash'
16
+ _common_teardown
17
+ }
18
+
19
+ @test " ddev core-version ^10" {
20
+ ddev core-version ^10
21
+ run -0 ddev exec ' drush st --fields=drupal-version --format=string | cut -d. -f1'
22
+ assert_output " 10"
23
+ }
24
+
25
+ @test " ddev core-version ^11" {
26
+ ddev core-version ^11
27
+ run -0 ddev exec ' drush st --fields=drupal-version --format=string | cut -d. -f1'
28
+ assert_output " 11"
29
+ }
30
+
31
+ @test " ddev core-version default" {
32
+ ddev core-version default
33
+ run -0 ddev exec ' drush st --fields=drupal-version --format=string | cut -d. -f1'
34
+ assert_output " 11"
35
+ }
36
+
37
+ @test " ddev core-version <none>" {
38
+ ddev core-version
39
+ run -0 ddev exec ' drush st --fields=drupal-version --format=string | cut -d. -f1'
40
+ assert_output " 11"
41
+ }
Original file line number Diff line number Diff line change @@ -38,12 +38,8 @@ teardown_file() {
38
38
39
39
@test " drupal core version" {
40
40
run -0 ddev exec ' drush st --fields=drupal-version --format=string | cut -d. -f1'
41
- if [ -n " ${TEST_DRUPAL_CORE} " ]; then
42
- assert_output " ${TEST_DRUPAL_CORE} "
43
- else
44
- DDEV_DRUPAL_CORE=$( ddev exec ' echo "${DRUPAL_CORE/^/}"' )
45
- assert_output " $DDEV_DRUPAL_CORE "
46
- fi
41
+ # Default core version is ^11.
42
+ assert_output " ${TEST_DRUPAL_CORE:- 11} "
47
43
}
48
44
49
45
@test " node tools availability" {
You can’t perform that action at this time.
0 commit comments