Skip to content

Instantly share code, notes, and snippets.

@Brunty
Created January 23, 2017 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Brunty/12e003c69b24e80af6259eb74aa43f62 to your computer and use it in GitHub Desktop.
Save Brunty/12e003c69b24e80af6259eb74aa43f62 to your computer and use it in GitHub Desktop.
<?php
namespace App\Context;
use Behat\Behat\Context\Context;
use Symfony\Component\Process\Process;
class ServerContext implements Context
{
const TIMEOUT = 10;
/**
* @var Process
*/
protected $process;
/**
* @BeforeScenario @run-server
*/
public function startServerCommand()
{
$this->process = new Process('exec php -S localhost:8000 -t ./');
$this->process->start();
}
/**
* @AfterScenario @run-server
*/
public function endServerCommand()
{
$this->process->stop(self::TIMEOUT, SIGTERM);
$this->process = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment