Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f7fd4b7

Browse files
authored
Move sandbox and SUT alongside Drush, instead of in a tmp dir (#3682)
* Move sandbox and SUT alongside Drush, instead of in a tmp dir * Fix yaml * remove slash. * Add sut/drush/sites dir * Add composer install to a CircleCI job * We don't care about ssh details * This test is a dupe of testExecute()? Cimment it out for now * More cleanup inside sut/drush. * Fix some fails. * Add debugging for InitCommandtest and fix test docs. * Dont mess with HOME at CircleCi. * debug. * Fix EGPCS at Circle, of course (WTF, is this 2005?) * remove -o PasswordAuthentication=no from expectation. * Revert an expectation.
1 parent c338658 commit f7fd4b7

34 files changed

+180
-393
lines changed

.circleci/config.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defaults: &defaults
66
TERM: dumb
77
UNISH_NO_TIMEOUTS: y
88
UNISH_DB_URL: mysql://root:@127.0.0.1
9-
UNISH_TMP: /tmp
109
PHPUNIT_ARGS: ""
1110

1211
version: 2
@@ -21,22 +20,23 @@ jobs:
2120
steps:
2221
- checkout
2322
- run: $HOME/drush/.circleci/setup.sh
24-
- run: unish.sut.php
25-
- run: unish.phpunit.php $PHPUNIT_ARGS
23+
- run: composer install
24+
- run: composer functional
2625

2726
build_highest:
2827
<<: *defaults
2928
docker:
3029
- image: circleci/php:7.1-apache-node
3130
environment:
3231
- MYSQL_HOST=127.0.0.1
33-
- COMPOSER=composer-highest.json
3432
- image: circleci/mysql:5.7.18
3533
steps:
3634
- checkout
3735
- run: $HOME/drush/.circleci/setup.sh
38-
- run: unish.sut.php
39-
- run: unish.phpunit.php $PHPUNIT_ARGS
36+
- run: composer remove --dev webflo/drupal-core-strict --no-update
37+
- run: composer require --dev drupal/core:8.7.x-dev --no-update
38+
- run: composer install
39+
- run: composer functional
4040

4141
build_56:
4242
<<: *defaults
@@ -48,8 +48,8 @@ jobs:
4848
steps:
4949
- checkout
5050
- run: $HOME/drush/.circleci/setup.sh
51-
- run: unish.sut.php
52-
- run: unish.phpunit.php $PHPUNIT_ARGS
51+
- run: composer install
52+
- run: composer functional
5353

5454
workflows:
5555
version: 2

.circleci/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ sudo apt-get install mysql-client
2121

2222
# Configure bash environment variables
2323
echo 'export PATH=~/.composer/vendor/bin:~/drush:$PATH' >> $BASH_ENV
24-
echo 'export HOME=/tmp/drush-sandbox/home' >> $BASH_ENV
25-
mkdir -p /tmp/drush-sandbox/home
2624

2725
# Configure php.ini
2826
echo 'mbstring.http_input = pass' > $HOME/php.ini
@@ -31,6 +29,8 @@ echo 'memory_limit = -1' >> $HOME/php.ini
3129
echo 'sendmail_path = /bin/true' >> $HOME/php.ini
3230
echo 'date.timezone = "UTC"' >> $HOME/php.ini
3331
echo 'opcache.enable_cli = 0' >> $HOME/php.ini
32+
echo 'variables_order = GPCS' >> $HOME/php.ini
33+
3434

3535
# Copy our php.ini configuration to the active php.ini file
3636
# We can't use `php -r 'print php_ini_loaded_file();` when there is no php.ini

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ api
1111
.idea/
1212
# https://github.com/drush-ops/drush/issues/2688
1313
composer.lock
14+
/sut/
15+
/sandbox/
16+
.env

composer.json

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@
2323
"bin": [
2424
"drush"
2525
],
26+
"repositories": {
27+
"drupal_org": {
28+
"type": "composer",
29+
"url": "https://packages.drupal.org/8"
30+
}
31+
},
2632
"require": {
2733
"php": ">=5.6.0",
2834
"ext-dom": "*",
29-
"chi-teck/drupal-code-generator": "^1.24.0",
35+
"chi-teck/drupal-code-generator": "^1.26.1",
3036
"composer/semver": "^1.4",
3137
"consolidation/annotated-command": "^2.8.1",
3238
"consolidation/config": "^1.1.0",
@@ -51,7 +57,13 @@
5157
"lox/xhprof": "dev-master",
5258
"g1a/composer-test-scenarios": "^2.2.0",
5359
"phpunit/phpunit": "^4.8.36|^5.5.4",
54-
"squizlabs/php_codesniffer": "^2.7"
60+
"squizlabs/php_codesniffer": "^2.7",
61+
"composer/installers": "^1.2",
62+
"cweagans/composer-patches": "~1.0",
63+
"webflo/drupal-core-strict": "8.6.x-dev",
64+
"drupal/empty_theme": "1.0",
65+
"drupal/devel": "^1.0@RC",
66+
"drupal/alinks": "1.0.0"
5567
},
5668
"autoload": {
5769
"psr-4": {
@@ -69,6 +81,7 @@
6981
"optimize-autoloader": true,
7082
"preferred-install": "dist",
7183
"sort-packages": true,
84+
"process-timeout": 2400,
7285
"platform": {
7386
"php": "5.6"
7487
}
@@ -91,13 +104,28 @@
91104
"sami-install": "mkdir -p $HOME/bin && curl --output $HOME/bin/sami.phar http://get.sensiolabs.org/sami.phar && chmod +x $HOME/bin/sami.phar",
92105
"scenario": "scenarios/install",
93106
"unit": "phpunit --colors=always",
94-
"functional": "./unish.phpunit.php",
107+
"functional": "phpunit --colors=always --configuration tests",
95108
"post-update-cmd": [
96109
"create-scenario isolation --autoload-dir isolation --autoload-dir internal-copy --keep '\\(psr/log\\|consolidation/config\\|site-alias\\|var-dumper\\|symfony/finder\\|drupal-finder\\|path-util\\|sebastian/version\\|xhprof\\)' 'phpunit/phpunit:^5.5.4'",
97110
"create-scenario isolation-phpunit4 --base isolation --autoload-dir isolation --autoload-dir internal-copy 'phpunit/phpunit:^4.8.36'"
98111
]
99112
},
100113
"extra": {
114+
"installer-paths": {
115+
"sut/core": ["type:drupal-core"],
116+
"sut/libraries/{$name}": ["type:drupal-library"],
117+
"sut/modules/unish/{$name}": ["drupal/devel"],
118+
"sut/themes/unish/{$name}": ["drupal/empty_theme"],
119+
"sut/modules/contrib/{$name}": ["type:drupal-module"],
120+
"sut/profiles/contrib/{$name}": ["type:drupal-profile"],
121+
"sut/themes/contrib/{$name}": ["type:drupal-theme"],
122+
"sut/drush/contrib/{$name}": ["type:drupal-drush"]
123+
},
124+
"patches": {
125+
"drupal/core": {
126+
"Allow updating modules with new service dependencies https://www.drupal.org/project/drupal/issues/2863986": "https://www.drupal.org/files/issues/2863986-2-49.patch"
127+
}
128+
},
101129
"branch-alias": {
102130
"dev-master": "9.x-dev"
103131
}

scenarios/isolation-phpunit4/composer.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@
2323
"bin": [
2424
"drush"
2525
],
26+
"repositories": {
27+
"drupal_org": {
28+
"type": "composer",
29+
"url": "https://packages.drupal.org/8"
30+
}
31+
},
2632
"require": {
2733
"php": ">=5.6.0",
2834
"ext-dom": "*",
2935
"consolidation/config": "^1.1.0",
3036
"consolidation/site-alias": "^1.1.2",
3137
"psr/log": "~1.0",
32-
"sebastian/version": "^1|^2",
3338
"symfony/finder": "~2.7|^3",
3439
"symfony/var-dumper": "~2.7|^3|^4",
3540
"webflo/drupal-finder": "^1.1",
@@ -78,13 +83,28 @@
7883
"sami-install": "mkdir -p $HOME/bin && curl --output $HOME/bin/sami.phar http://get.sensiolabs.org/sami.phar && chmod +x $HOME/bin/sami.phar",
7984
"scenario": "scenarios/install",
8085
"unit": "phpunit --colors=always",
81-
"functional": "./unish.phpunit.php",
86+
"functional": "phpunit --colors=always --configuration tests",
8287
"post-update-cmd": [
8388
"create-scenario isolation --autoload-dir isolation --autoload-dir internal-copy --keep '\\(psr/log\\|consolidation/config\\|site-alias\\|var-dumper\\|symfony/finder\\|drupal-finder\\|path-util\\|sebastian/version\\|xhprof\\)' 'phpunit/phpunit:^5.5.4'",
8489
"create-scenario isolation-phpunit4 --base isolation --autoload-dir isolation --autoload-dir internal-copy 'phpunit/phpunit:^4.8.36'"
8590
]
8691
},
8792
"extra": {
93+
"installer-paths": {
94+
"sut/core": ["type:drupal-core"],
95+
"sut/libraries/{$name}": ["type:drupal-library"],
96+
"sut/modules/unish/{$name}": ["drupal/devel"],
97+
"sut/themes/unish/{$name}": ["drupal/empty_theme"],
98+
"sut/modules/contrib/{$name}": ["type:drupal-module"],
99+
"sut/profiles/contrib/{$name}": ["type:drupal-profile"],
100+
"sut/themes/contrib/{$name}": ["type:drupal-theme"],
101+
"sut/drush/contrib/{$name}": ["type:drupal-drush"]
102+
},
103+
"patches": {
104+
"drupal/core": {
105+
"Allow updating modules with new service dependencies https://www.drupal.org/project/drupal/issues/2863986": "https://www.drupal.org/files/issues/2863986-2-49.patch"
106+
}
107+
},
88108
"branch-alias": {
89109
"dev-master": "9.x-dev"
90110
}

scenarios/isolation/composer.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,18 @@
2323
"bin": [
2424
"drush"
2525
],
26+
"repositories": {
27+
"drupal_org": {
28+
"type": "composer",
29+
"url": "https://packages.drupal.org/8"
30+
}
31+
},
2632
"require": {
2733
"php": ">=5.6.0",
2834
"ext-dom": "*",
2935
"consolidation/config": "^1.1.0",
3036
"consolidation/site-alias": "^1.1.2",
3137
"psr/log": "~1.0",
32-
"sebastian/version": "^1|^2",
3338
"symfony/finder": "~2.7|^3",
3439
"symfony/var-dumper": "~2.7|^3|^4",
3540
"webflo/drupal-finder": "^1.1",
@@ -78,13 +83,28 @@
7883
"sami-install": "mkdir -p $HOME/bin && curl --output $HOME/bin/sami.phar http://get.sensiolabs.org/sami.phar && chmod +x $HOME/bin/sami.phar",
7984
"scenario": "scenarios/install",
8085
"unit": "phpunit --colors=always",
81-
"functional": "./unish.phpunit.php",
86+
"functional": "phpunit --colors=always --configuration tests",
8287
"post-update-cmd": [
8388
"create-scenario isolation --autoload-dir isolation --autoload-dir internal-copy --keep '\\(psr/log\\|consolidation/config\\|site-alias\\|var-dumper\\|symfony/finder\\|drupal-finder\\|path-util\\|sebastian/version\\|xhprof\\)' 'phpunit/phpunit:^5.5.4'",
8489
"create-scenario isolation-phpunit4 --base isolation --autoload-dir isolation --autoload-dir internal-copy 'phpunit/phpunit:^4.8.36'"
8590
]
8691
},
8792
"extra": {
93+
"installer-paths": {
94+
"sut/core": ["type:drupal-core"],
95+
"sut/libraries/{$name}": ["type:drupal-library"],
96+
"sut/modules/unish/{$name}": ["drupal/devel"],
97+
"sut/themes/unish/{$name}": ["drupal/empty_theme"],
98+
"sut/modules/contrib/{$name}": ["type:drupal-module"],
99+
"sut/profiles/contrib/{$name}": ["type:drupal-profile"],
100+
"sut/themes/contrib/{$name}": ["type:drupal-theme"],
101+
"sut/drush/contrib/{$name}": ["type:drupal-drush"]
102+
},
103+
"patches": {
104+
"drupal/core": {
105+
"Allow updating modules with new service dependencies https://www.drupal.org/project/drupal/issues/2863986": "https://www.drupal.org/files/issues/2863986-2-49.patch"
106+
}
107+
},
88108
"branch-alias": {
89109
"dev-master": "9.x-dev"
90110
}

src/Commands/pm/SecurityUpdateCommands.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,17 @@ protected function loadSiteComposerLock()
133133
* @param array $security_advisories_composer_json
134134
* The composer.json array from drupal-security-advisories.
135135
*/
136-
protected function registerAllSecurityUpdates(
137-
$composer_lock_data,
138-
$security_advisories_composer_json
139-
) {
140-
foreach ($composer_lock_data['packages'] as $key => $package) {
136+
protected function registerAllSecurityUpdates($composer_lock_data, $security_advisories_composer_json)
137+
{
138+
$both = $composer_lock_data['packages-dev'] + $composer_lock_data['packages'];
139+
foreach ($both as $package) {
141140
$name = $package['name'];
142141
$this->registerPackageSecurityUpdates($security_advisories_composer_json, $name, $package);
143142
}
144143
}
145144

146145
/**
147-
* Determines if update is avaiable based on a conflict constraint.
146+
* Determines if update is available based on a conflict constraint.
148147
*
149148
* @param string $conflict_constraint
150149
* The constraint for the conflicting, insecure package version.

src/Preflight/RedispatchToSiteLocal.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ class RedispatchToSiteLocal
2727
*/
2828
public static function redispatchIfSiteLocalDrush($argv, $root, $vendor, PreflightLog $preflightLog)
2929
{
30-
// Special check for the SUT, which is always a site-local install.
31-
// The symlink that Composer sets up can make it challenging to
32-
// detect that the vendor directory is in the same place. Do not
33-
// set DRUSH_AUTOLOAD_PHP unless you know what you are doing! This
34-
// mechanism should be reserved for use with test fixtures.
35-
if (getenv('DRUSH_AUTOLOAD_PHP')) {
36-
return false;
37-
}
3830

3931
// Try to find the site-local Drush. If there is none, we are done.
4032
$siteLocalDrush = static::findSiteLocalDrush($root);

sut

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

sut/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory is used by Unish, Drush's own test suite. Its name is short for System Under Test https://en.wikipedia.org/wiki/System_under_test

0 commit comments

Comments
 (0)