Skip to content

Commit

Permalink
2nd check that parse_url returns array
Browse files Browse the repository at this point in the history
  • Loading branch information
back-2-95 committed Jun 28, 2021
1 parent fe36fa1 commit 3b20fa0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test:
@echo "Run composer test (all tests)"
@docker run --rm -it --volume $$PWD:/app druidfi/drupal:7.3 composer test
@docker run --rm -it --volume $$PWD:/app druidfi/drupal:7.4 composer test

test-%:
@echo "Run composer test-$*"
@docker run --rm -it --volume $$PWD:/app druidfi/drupal:7.3 composer test-$*
@docker run --rm -it --volume $$PWD:/app druidfi/drupal:7.4 composer test-$*
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ basically what `druidfi/omen` is doing. Your local clouds too.

## Other information

This project is found from the Packagist: https://packagist.org/packages/druidfi/omen
This project can be found from the Packagist: https://packagist.org/packages/druidfi/omen
8 changes: 6 additions & 2 deletions src/DrupalEnvDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,12 @@ private function setTrustedHostPatterns() {
$drush_options_uri = getenv('DRUSH_OPTIONS_URI');

if ($drush_options_uri && !in_array($drush_options_uri, $routes)) {
$host = str_replace('.', '\.', parse_url($drush_options_uri)['host']);
$this->settings['trusted_host_patterns'][] = '^' . $host . '$';
$parsed_host = parse_url($drush_options_uri);

if (is_array($parsed_host)) {
$host = str_replace('.', '\.', $parsed_host['host']);
$this->settings['trusted_host_patterns'][] = '^' . $host . '$';
}
}

// If not explicitly set, use first host as DRUSH_OPTIONS_URI
Expand Down
2 changes: 1 addition & 1 deletion tests/BaseCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ abstract class BaseCase extends TestCase
protected function setUp(): void
{
if (!class_exists('Drupal')) {
eval("class Drupal { const VERSION = '8.8.2'; }");
eval("class Drupal { const VERSION = '9.2.0'; }");
}

$detector = new DrupalEnvDetector(__DIR__);
Expand Down
2 changes: 2 additions & 0 deletions tests/Wodby.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<env name="WODBY_HOST_PRIMARY" value="local.drupal.com"/>
<env name="WODBY_INSTANCE_TYPE" value="dev"/>
<env name="WODBY_URL_PRIMARY" value="http://dev.drupal.wod.by"/>
<env name="DRUPAL_ROUTES" value="https://dev.drupal.com"/>
<env name="DRUSH_OPTIONS_URI" value="https://cli.drupal.com"/>
<env name="DB_DRIVER" value="mysql"/>
<env name="DB_NAME" value="drupal"/>
<env name="DB_USER" value="drupal"/>
Expand Down

0 comments on commit 3b20fa0

Please sign in to comment.