-
-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathCreateNewConsoleTest.php
45 lines (40 loc) · 1.33 KB
/
CreateNewConsoleTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;
/**
* @author Andrei Olteanu <[email protected]>
*/
class CreateNewConsoleTest extends TestCase
{
public function testOptionCreateNewConsole()
{
$this->expectNotToPerformAssertions();
try {
$process = new Process(['php', __DIR__.'/ThreeSecondProcess.php']);
$process->setOptions(['create_new_console' => true]);
$process->disableOutput();
$process->start();
} catch (\Exception $e) {
$this->fail($e);
}
}
public function testItReturnsFastAfterStart()
{
// The started process must run in background after the main has finished but that can't be tested with PHPUnit
$startTime = microtime(true);
$process = new Process(['php', __DIR__.'/ThreeSecondProcess.php']);
$process->setOptions(['create_new_console' => true]);
$process->disableOutput();
$process->start();
$this->assertLessThan(3000, $startTime - microtime(true));
}
}