Skip to content
Snippets Groups Projects
Commit 4677fccd authored by jurgenhaas's avatar jurgenhaas
Browse files

Grab the projectname vrom Docker4Drupal

Use container internal baseurl by default
parent 4d9aca80
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ namespace LakeDrops\Behat4Drupal;
use Composer\Script\Event;
use LakeDrops\Component\Composer\BaseHandler;
use LakeDrops\Component\Dotenv\Dotenv;
use LakeDrops\Docker4Drupal\Handler as D4DHandler;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Yaml\Yaml;
......@@ -112,13 +113,20 @@ class Handler extends BaseHandler {
* The settings from the extra configuration.
*/
protected function getOptions() {
$projectname = str_replace([' ', '-', '_', '.'], '', basename(getcwd()));
$handler = new D4DHandler($this->composer, $this->io);
$projectname = $handler->getOptions('projectname');
$webserver = $handler->getOptions('webserver');
$env = new Dotenv('behat4drupal', $this->io);
$env->put('COMPOSE_PROJECT_NAME', $projectname);
$extra = $this->composer->getPackage()->getExtra() + ['behat4drupal' => []];
$options = $extra['behat4drupal'] + [
'projectname' => $projectname,
];
$options['baseurl'] = empty($options['global']) ?
$webserver['type'] :
$projectname . '.docker.localhost:8000';
return $env->replaceEnvironmentVariables($options);
}
......
......@@ -18,7 +18,7 @@ default:
drush:
alias: default.dev
Behat\MinkExtension:
base_url: http://{{ projectname }}.docker.localhost:8000
base_url: http://{{ baseurl }}
goutte: ~
default_session: goutte
javascript_session: MyLocalChrome
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment