Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving Behat + Drupal VM integration. #462

Merged
merged 2 commits into from
Sep 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion scripts/drupal-vm/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ extra_packages:
- php-bcmath

post_provision_scripts:
- "../vendor/acquia/blt/scripts/drupal-vm/post-provision.sh"
- "../../../acquia/blt/scripts/drupal-vm/post-provision.sh"
3 changes: 2 additions & 1 deletion scripts/drupal-vm/post-provision.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/env bash

export $PATH=/var/www/$(hostname)/vendor/bin:$PATH
# Append vendor/bin to $PATH via ~/.bashrc modification.
grep -q -F 'export PATH=/var/www/$(hostname)/vendor/bin:$PATH' .bashrc || echo 'export PATH=/var/www/$(hostname)/vendor/bin:$PATH' >> .bashrc
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