ciaranmcnulty/behat-localwebserverextension

Extension for behat users who forget to start their webserver

Maintainers

👁 ciaranmcnulty

Package info

github.com/ciaranmcnulty/behat-localwebserverextension

Homepage

pkg:composer/ciaranmcnulty/behat-localwebserverextension

Statistics

Installs: 27 274

Dependents: 9

Suggesters: 0

Stars: 14

Open Issues: 3

1.1.3 2016-05-28 20:54 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 0ac9cfbf608134e19d67b7856bb42854f1bc80dc

BDDBehatTDD

This package is auto-updated.

Last update: 2026-05-24 07:48:04 UTC


README

A trivial extension for people who forget to start their webserver

👁 Build Status

Installation

Require in composer

composer require ciaranmcnulty/behat-localwebserverextension --dev

Usage

Add to your behat.yml:

default:
 extensions:
 Cjm\Behat\LocalWebserverExtension: ~

Run your suite, and your web examples should pass - the internal PHP webserver is started at suite start and exited at suite end.

Advanced Configuration

Available configuration options:

default:
 extensions:
 Cjm\Behat\LocalWebserverExtension:
 host : 192.168.1.1 # defaults to 'localhost'
 port : 80 # defaults to '8000'
 docroot: /wwroot # defaults to '%paths.base%/web'
 router: router.php # defaults to 'null'
 suites: [ web, ui ] # defaults to (all suites)

If your behat config is elsewhere than in your root directory (for example app/behat.yml you need to customize the docroot to the right path. In our example it would be docroot: '%paths.base%/../web'

Usage with MinkExtension

When MinkExtension is used, default host and port will be read from Mink's base_url setting , but you can still override if required.

default:
 extensions:
 Behat\MinkExtension:
 base_url: 'http://dev.local:9001'
 sessions:
 default:
 goutte: ~
 Cjm\Behat\LocalWebserverExtension: ~

Limitations

To do:

  • Only turn webserver on for certain contexts
  • Support symfony app console
  • Support custom server startup / stop commands