forked from php-runtime/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRuntimeTest.php
More file actions
48 lines (38 loc) · 1.44 KB
/
RuntimeTest.php
File metadata and controls
48 lines (38 loc) · 1.44 KB
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
46
47
48
<?php
declare(strict_types=1);
namespace Runtime\FrankenPhpSymfony\Tests;
use PHPUnit\Framework\TestCase;
use Runtime\FrankenPhpSymfony\ResponseRunner;
use Runtime\FrankenPhpSymfony\Runner;
use Runtime\FrankenPhpSymfony\Runtime;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* @author Kévin Dunglas <kevin@dunglas.dev>
*/
final class RuntimeTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();
unset($_SERVER['FRANKENPHP_WORKER']);
}
public function testGetRunner(): void
{
$application = $this->createStub(HttpKernelInterface::class);
$runtime = new Runtime();
$this->assertNotInstanceOf(Runner::class, $runtime->getRunner(null));
$this->assertNotInstanceOf(Runner::class, $runtime->getRunner($application));
$_SERVER['FRANKENPHP_WORKER'] = 1;
$this->assertInstanceOf(Runner::class, $runtime->getRunner($application));
}
public function testGetResponseRunner(): void
{
$application = $this->createStub(Response::class);
$runtime = new Runtime();
$this->assertNotInstanceOf(ResponseRunner::class, $runtime->getRunner(null));
$this->assertNotInstanceOf(ResponseRunner::class, $runtime->getRunner($application));
$_SERVER['FRANKENPHP_WORKER'] = 1;
$this->assertInstanceOf(ResponseRunner::class, $runtime->getRunner($application));
}
}