2017 © Pedro Peláez
 

library behat-localwebserverextension

Extension for behat users who forget to start their webserver

image

ciaranmcnulty/behat-localwebserverextension

Extension for behat users who forget to start their webserver

  • Saturday, May 28, 2016
  • by ciaranmcnulty
  • Repository
  • 2 Watchers
  • 13 Stars
  • 21,387 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 8 Versions
  • 8 % Grown

The README.md

Behat Local Webserver Extension

A trivial extension for people who forget to start their webserver, (*1)

Build Status, (*2)

Installation

Require in composer, (*3)

composer require ciaranmcnulty/behat-localwebserverextension --dev

Usage

Add to your behat.yml:, (*4)

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., (*5)

Advanced Configuration

Available configuration options:, (*6)

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', (*7)

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., (*8)

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

Limitations

To do:, (*9)

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

The Versions