Skip to content

Commit

Permalink
Fixing Behat + DrupalVM integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Sep 27, 2016
1 parent d3c44a1 commit ac940d3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
35 changes: 35 additions & 0 deletions phing/tasks/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,41 @@
<expandproperties />
</filterchain>
</copy>

<exec dir="${repo.root}" command="php -r 'require &quot;./vendor/jakoch/phantomjs-installer/src/PhantomInstaller/PhantomBinary.php&quot;; $pb = new \PhantomInstaller\PhantomBinary(); echo $pb->getBin();'" checkreturn="false" returnProperty="phantomjs.missing" outputProperty="phantomjs.bin"/>
<if>
<or>
<istrue value="${phantomjs.missing}"/>
<not><available file="${composer.bin}/phantomjs"/></not>
<not><available file="${phantomjs.bin}"/></not>
</or>
<then>
<exec dir="${repo.root}" command="composer install-phantom" checkreturn="true" logoutput="true" passthru="true" level="info"/>
</then>
<else>
<echo>Found PhantomJS at ${phantomjs.bin}</echo>
</else>
</if>

<property file="${repo.root}/tests/behat/local.yml" prefix="behatConfig"/>
<if>
<or>
<not><available file="${behatConfig.local.extensions.Drupal\DrupalExtension.drupal.drupal_root}"/></not>
<not><available file="${behatConfig.local.suites.default.paths.features}"/></not>
<not><available file="${behatConfig.local.suites.default.paths.bootstrap}"/></not>
</or>
<then>
<echo></echo>
<echo level="error">One or more values in tests/behat/local.yml reference file paths that do not exist on this system.</echo>
<echo level="error">Either correct the value(s) or remove tests/behat/local.yml so that it can be regenerated automatically from example.local.yml.</echo>
<echo level="error">Values are:</echo>
<echo level="error">drupal_root: ${behatConfig.local.extensions.Drupal\DrupalExtension.drupal.drupal_root}"</echo>
<echo level="error">features: ${behatConfig.local.suites.default.paths.features}"</echo>
<echo level="error">bootstrap: ${behatConfig.local.suites.default.paths.bootstrap}</echo>
<fail>Your Behat configuration is invalid.</fail>
</then>
</if>

</target>

<!-- This is run when a project is cloned to a new environment. -->
Expand Down
1 change: 0 additions & 1 deletion readme/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ To execute Behat tests using the 'drupal' driver on a Drupal VM environment, you
1. Update `tests/behat/local.yml` with the absolute file path to your project _inside the VM_. I.e., find and replace all instances of `host/machine/path/to/repo` with `/vm/path/to/repo`, which should look something like `var/www/[project.machine_name]`.
1. SSH into the VM `vagrant ssh`.
1. Change to your project directory `cd /var/www/[project.machine_name]`.
1. Assert that PhantomJS is installed for VM. Unfortunately, this requires building Composer dependencies while SSHed into the VM: `rm -rf vendor && composer install`.
1. Execute behat tests `blt tests:behat`

#### Using the Drupal Extension's "drush" driver with Drupal VM
Expand Down
1 change: 1 addition & 0 deletions scripts/blt/install-alias.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ if [ ! -z "$DETECTED_PROFILE" ]; then
echo "BLT can automatically create a Bash alias to make it easier to run BLT tasks."
echo "This alias may be created in .bash_profile or .bashrc depending on your system architecture."
echo ""
sleep 1

if [ -z $REPLY ]; then
read -p "Install alias? (y/n)" -n 1 -r
Expand Down
1 change: 1 addition & 0 deletions template/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
}
},
"scripts": {
"reinstall-phantomjs": "rm -rf vendor/bin/phantomjs && @install-phantomjs",
"install-phantomjs": "PhantomInstaller\\Installer::installPhantomJS",
"blt-alias": "blt install-alias -Dcreate_alias=true",
"post-install-cmd": [
Expand Down

0 comments on commit ac940d3

Please sign in to comment.