These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of phpDocumentor. |
||
4 | * |
||
5 | * For the full copyright and license information, please view the LICENSE |
||
6 | * file that was distributed with this source code. |
||
7 | * |
||
8 | * @author Mike van Riel <[email protected]> |
||
9 | * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) |
||
10 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
11 | * @link http://phpdoc.org |
||
12 | * |
||
13 | * |
||
14 | */ |
||
15 | |||
16 | namespace phpDocumentor\Behat\Contexts\Template; |
||
17 | |||
18 | use Behat\Behat\Context\Context; |
||
19 | use Behat\Behat\Hook\Scope\BeforeScenarioScope; |
||
20 | use phpDocumentor\Behat\Contexts\EnvironmentContext; |
||
21 | use Symfony\Component\Process\Process; |
||
22 | |||
23 | final class TemplateContext implements Context |
||
24 | { |
||
25 | /** @var EnvironmentContext */ |
||
26 | private $environmentContext; |
||
27 | |||
28 | /** @var Process */ |
||
29 | private $webserver; |
||
30 | |||
31 | /** @BeforeScenario */ |
||
32 | public function gatherContexts(BeforeScenarioScope $scope) |
||
33 | { |
||
34 | $environment = $scope->getEnvironment(); |
||
35 | |||
36 | $this->environmentContext = $environment->getContext('phpDocumentor\Behat\Contexts\EnvironmentContext'); |
||
37 | } |
||
38 | |||
39 | /** @BeforeScenario */ |
||
40 | public function beforeScenario() |
||
41 | { |
||
42 | $workingDir = $this->environmentContext->getWorkingDir(); |
||
43 | |||
44 | $this->webserver = new Process( |
||
45 | sprintf('php -S localhost:8081 -t %s', escapeshellarg($workingDir)) |
||
46 | ); |
||
47 | |||
48 | $this->webserver->start(function () { |
||
49 | var_dump("Server started"); |
||
0 ignored issues
–
show
Security
Debugging Code
introduced
by
Loading history...
|
|||
50 | }); |
||
51 | // sleep(1); |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * @AfterScenario |
||
56 | */ |
||
57 | public function cleanup() |
||
58 | { |
||
59 | if ($this->webserver->isStarted()) { |
||
60 | $this->webserver->stop(); |
||
61 | } |
||
62 | } |
||
63 | } |
||
64 |