Created
January 23, 2017 09:58
-
-
Save Brunty/12e003c69b24e80af6259eb74aa43f62 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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