-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIntegrationTest.php
40 lines (31 loc) · 981 Bytes
/
IntegrationTest.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
<?php
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\Process;
use GuzzleHttp\Client;
class IntegrationTest extends TestCase
{
/** @var Process */
private static $process;
public static function setUpBeforeClass()
{
self::$process = new Process("php -S localhost:8080 -t .");
self::$process->start();
usleep(100000); //wait for server to get going
}
public static function tearDownAfterClass()
{
self::$process->stop();
}
public function test404()
{
$client = new Client(['http_errors' => false]);
$response = $client->request("GET", "http://localhost:8080");
$this->assertEquals(404, $response->getStatusCode());
}
public function test200()
{
$client = new Client(['http_errors' => false]);
$response = $client->request("GET", "http://localhost:8080/testpage/");
$this->assertEquals(200, $response->getStatusCode());
}
}