Repository navigation
Expand file tree
/
Copy pathGetTest.php
More file actions
56 lines (43 loc) · 1.43 KB
/
Copy pathGetTest.php
File metadata and controls
56 lines (43 loc) · 1.43 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
49
50
51
52
53
54
55
56
<?php
use PHPUnit\Framework\TestCase;
class GetTest extends TestCase
{
private $http;
public function setUp() : void
{
$this->http = new GuzzleHttp\Client(['base_uri' => 'http://0.0.0.0:8080']);
}
public function tearDown() : void
{
$this->http = null;
}
public function testGet()
{
$response = $this->http->get('/api/test');
$data = json_decode($response->getBody(), true);
$this->assertEquals($data[0]['name'], 'Luke');
$this->assertEquals(200, $response->getStatusCode());
}
public function testGetParam()
{
$response = $this->http->get('/api/test/chris');
$data = json_decode($response->getBody(), true);
$this->assertEquals($data[0], 'chris');
$this->assertEquals(200, $response->getStatusCode());
}
public function testGetWithKey()
{ // fix when we have the key
$response = $this->http->get('/api/test/chris');
$data = json_decode($response->getBody(), true);
$this->assertEquals($data[0], 'chris');
$this->assertEquals(200, $response->getStatusCode());
}
public function testGetParamWithKey()
{
// fix when we have the key
$response = $this->http->get('/api/test/chris');
$data = json_decode($response->getBody(), true);
$this->assertEquals($data[0], 'chris');
$this->assertEquals(200, $response->getStatusCode());
}
}