Skip to content

Commit d39847d

Browse files
authored
Update to Symfony 3.4 as minimum. (#3697)
* Update to Symfony 3.4 as minimum. Drops support for Symfony 2 which was used in Drupal 8.3 and prior. * Use new env variable feature of Process 3.1
1 parent 175a171 commit d39847d

File tree

7 files changed

+16
-29
lines changed

7 files changed

+16
-29
lines changed

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@
4343
"league/container": "~2",
4444
"psr/log": "~1.0",
4545
"psy/psysh": "~0.6",
46-
"symfony/config": "~2.2|^3",
47-
"symfony/console": "~2.7|^3",
48-
"symfony/event-dispatcher": "~2.7|^3",
49-
"symfony/finder": "~2.7|^3",
50-
"symfony/process": "~2.7|^3",
51-
"symfony/var-dumper": "~2.7|^3|^4",
52-
"symfony/yaml": "~2.3|^3",
46+
"symfony/config": "^3.4",
47+
"symfony/console": "^3.4",
48+
"symfony/event-dispatcher": "^3.4",
49+
"symfony/finder": "^3.4",
50+
"symfony/process": "^3.4",
51+
"symfony/var-dumper": "^3.4",
52+
"symfony/yaml": "^3.4",
5353
"webflo/drupal-finder": "^1.1",
5454
"webmozart/path-util": "^2.1.0"
5555
},

scenarios/isolation-phpunit4/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"consolidation/config": "^1.1.0",
3636
"consolidation/site-alias": "^1.1.5",
3737
"psr/log": "~1.0",
38-
"symfony/finder": "~2.7|^3",
39-
"symfony/var-dumper": "~2.7|^3|^4",
38+
"symfony/finder": "^3.4",
39+
"symfony/var-dumper": "^3.4",
4040
"webflo/drupal-finder": "^1.1",
4141
"webmozart/path-util": "^2.1.0"
4242
},

scenarios/isolation/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
"consolidation/config": "^1.1.0",
3636
"consolidation/site-alias": "^1.1.5",
3737
"psr/log": "~1.0",
38-
"symfony/finder": "~2.7|^3",
39-
"symfony/var-dumper": "~2.7|^3|^4",
38+
"symfony/finder": "^3.4",
39+
"symfony/var-dumper": "^3.4",
4040
"webflo/drupal-finder": "^1.1",
4141
"webmozart/path-util": "^2.1.0"
4242
},

tests/AnnotatedCommandTest.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ public function testGlobal()
3737
'directory' => self::getSandbox(),
3838
];
3939

40-
$original = getenv('SHELL_INTERACTIVE');
41-
$this->setEnv(['SHELL_INTERACTIVE' => 1]);
42-
$this->drush('generate', ['foo-example'], $options);
43-
$this->setEnv(['SHELL_INTERACTIVE' => $original]);
40+
$this->drush('generate', ['foo-example'], $options, null, null, self::EXIT_SUCCESS, null, ['SHELL_INTERACTIVE' => 1]);
4441

4542
$target = Path::join($options['directory'], 'foo.php');
4643
$actual = trim(file_get_contents($target));
@@ -86,10 +83,7 @@ public function testExecute()
8683
]);
8784
$optionsExample['directory'] = self::webrootSlashDrush();
8885
$optionsExample['yes'] = null;
89-
$original = getenv('SHELL_INTERACTIVE');
90-
$this->setEnv(['SHELL_INTERACTIVE' => 1]);
91-
$this->drush('generate', ['woot-example'], $optionsExample);
92-
$this->setEnv(['SHELL_INTERACTIVE' => $original]);
86+
$this->drush('generate', ['woot-example'], $optionsExample, null, null, self::EXIT_SUCCESS, null, ['SHELL_INTERACTIVE' => 1]);
9387
$target = Path::join($optionsExample['directory'], 'Commands/ExampleBarCommands.php');
9488
$actual = trim(file_get_contents($target));
9589
$this->assertEquals('ExampleBarCommands says Woot mightily.', $actual);

tests/CommandUnishTestCase.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ public function getOutputFromJSON($key = null)
216216
* @param sting cd
217217
* The directory to run the command in.
218218
* @param array $env
219-
* @todo: Not fully implemented yet. Inheriting environment is hard - http://stackoverflow.com/questions/3780866/why-is-my-env-empty.
220-
* @see drush_env().
221219
* Extra environment variables.
222220
* @param string $input
223221
* A string representing the STDIN that is piped to the command.
@@ -226,7 +224,6 @@ public function getOutputFromJSON($key = null)
226224
*/
227225
public function execute($command, $expected_return = self::EXIT_SUCCESS, $cd = null, $env = null, $input = null)
228226
{
229-
$return = 1;
230227
$this->tick();
231228

232229
// Apply the environment variables we need for our test to the head of the
@@ -245,7 +242,8 @@ public function execute($command, $expected_return = self::EXIT_SUCCESS, $cd = n
245242

246243
try {
247244
// Process uses a default timeout of 60 seconds, set it to 0 (none).
248-
$this->process = new Process($command, $cd, null, $input, 0);
245+
$this->process = new Process($command, $cd, $env, $input, 0);
246+
$this->process->inheritEnvironmentVariables(true);
249247
if (!getenv('UNISH_NO_TIMEOUTS')) {
250248
$this->process->setTimeout($this->timeout)
251249
->setIdleTimeout($this->idleTimeout);

tests/UnishTestCase.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,6 @@ public function drupalSitewideDirectory()
651651
*
652652
* @param array $vars
653653
* The variables to set.
654-
*
655-
* We will change implementation to take advantage of https://github.com/symfony/symfony/pull/19053/files once we drop Symfony 2 compat.
656654
*/
657655
public static function setEnv(array $vars)
658656
{

tests/UserTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,7 @@ public function testUserCancel()
122122
'rest_configuration' => 'no',
123123
];
124124
$answers = json_encode($answers);
125-
$original = getenv('SHELL_INTERACTIVE');
126-
$this->setEnv(['SHELL_INTERACTIVE' => 1]);
127-
$this->drush('generate', ['content-entity'], ['answers' => $answers, 'directory' => Path::join(self::webroot(), 'modules/contrib')]);
128-
$this->setEnv(['SHELL_INTERACTIVE' => $original]);
125+
$this->drush('generate', ['content-entity'], ['answers' => $answers, 'directory' => Path::join(self::webroot(), 'modules/contrib')], null, null, self::EXIT_SUCCESS, null, ['SHELL_INTERACTIVE' => 1]);
129126
$this->drush('pm-enable', ['text,unish_article']);
130127
// Create one unish_article owned by our example user.
131128
$this->drush('php-script', ['create_unish_articles'], ['script-path' => Path::join(__DIR__, 'resources')]);

0 commit comments

Comments
 (0)