forked from clue/reactphp-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResponseParserTest.php
More file actions
43 lines (34 loc) · 946 Bytes
/
ResponseParserTest.php
File metadata and controls
43 lines (34 loc) · 946 Bytes
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
<?php
namespace Clue\Tests\React\Docker\Io;
use Clue\React\Docker\Io\ResponseParser;
use Clue\Tests\React\Docker\TestCase;
use React\Http\Message\Response;
class ResponseParserTest extends TestCase
{
private $parser;
/**
* @before
*/
public function setUpParser()
{
$this->parser = new ResponseParser();
}
public function testPlain()
{
$body = 'OK';
$this->assertEquals($body, $this->parser->expectPlain($this->createResponse($body)));
}
public function testJson()
{
$json = array('test' => 'value');
$this->assertEquals($json, $this->parser->expectJson($this->createResponse(json_encode($json))));
}
public function testEmpty()
{
$this->assertEquals('', $this->parser->expectEmpty($this->createResponse()));
}
private function createResponse($body = '')
{
return new Response(200, array(), $body);
}
}