Skip to content

Commit

Permalink
Merge pull request #321 from rexxars/behat-httpd-log
Browse files Browse the repository at this point in the history
Behat config option for path of internal httpd log location
  • Loading branch information
rexxars committed Jan 14, 2015
2 parents a921bc1 + 52b11de commit ac0205a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 3 additions & 0 deletions tests/behat/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ default:
documentRoot: public
router: %behat.paths.base%/router.php

# httpd log file location
httpdLog: /dev/null

# Timeout when trying to connect to the built in httpd
timeout: 5

Expand Down
11 changes: 7 additions & 4 deletions tests/behat/bootstrap/RESTContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ public static function setUp(SuiteEvent $event) {
$url['host'],
$port,
$params['documentRoot'],
$params['router']
$params['router'],
$params['httpdLog']
);

if (!$pid) {
Expand Down Expand Up @@ -401,15 +402,17 @@ private static function canConnectToHttpd($host, $port) {
* @param int $port The port to use
* @param string $documentRoot The document root
* @param string $router Path to an optional router
* @param string $httpdLog Path the httpd log should be written to
* @return int Returns the PID of the httpd
* @throws RuntimeException
*/
private static function startBuiltInHttpd($host, $port, $documentRoot, $router = null) {
$command = sprintf('php -S %s:%d -t %s %s >/dev/null 2>&1 & echo $!',
private static function startBuiltInHttpd($host, $port, $documentRoot, $router, $httpdLog) {
$command = sprintf('php -S %s:%d -t %s %s >%s 2>&1 & echo $!',
$host,
$port,
$documentRoot,
$router);
$router,
$httpdLog);

$output = array();
exec($command, $output);
Expand Down

0 comments on commit ac0205a

Please sign in to comment.