Some example acceptance tests using Behat, Mink, Goutte, and PhantomJS.
- Get Composer
php composer.phar install
- Get Node
npm install
- Start phantomjs for javascript tests with
node_modules/.bin/phantomjs --webdriver=8643
- Run tests with
vendor/bin/behat
composer require behat/behat behat/mink behat/mink-extension behat/mink-selenium2-driver
- add behat.yml mink boilerplate to root or mink will not work
vendor/bin/behat --init
- Install phantomjs for javascript tests:
npm init
and enter a bunchnpm install --save-dev phantomjs
- Start phantomjs running with
node_modules/.bin/phantomjs --webdriver=8643
- edit
features/bootstrap/FeatureContext.php
. Ensure the classextends \Behat\MinkExtension\Context\MinkContext
. - create a feature
my-feature-name.feature
infeatures/
using gherkin syntax - add the feature functions to
features/bootstrap/FeatureContext.php
withbehat --append-snippets --dry-run
- use the mink api to complete each test
vendor/bin/behat
to run tests- for javascript tests, add
@javascript
above the feature. With thebehat.yml
mentioned above it will use phantomjs if you have it running.