blob: f6c24767793a1e3cc0f93a5e3bc3d5758dd7b20f (
plain)
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
|
<?php
namespace Engelsystem\Test\Unit\Http;
use Engelsystem\Http\Response;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
class ResponseTest extends TestCase
{
/**
* @covers \Engelsystem\Http\Response
*/
public function testCreate()
{
$response = new Response();
$this->assertInstanceOf(SymfonyResponse::class, $response);
$this->assertInstanceOf(ResponseInterface::class, $response);
}
/**
* @covers \Engelsystem\Http\Response::withStatus
* @covers \Engelsystem\Http\Response::getReasonPhrase
*/
public function testWithStatus()
{
$response = new Response();
$newResponse = $response->withStatus(503);
$this->assertNotEquals($response, $newResponse);
$this->assertNotEquals('', $newResponse->getReasonPhrase());
$this->assertEquals(503, $newResponse->getStatusCode());
$newResponse = $response->withStatus(503, 'Foo');
$this->assertEquals('Foo', $newResponse->getReasonPhrase());
}
/**
* @covers \Engelsystem\Http\Response::withContent
*/
public function testWithContent()
{
$response = new Response();
$newResponse = $response->withContent('Lorem Ipsum?');
$this->assertNotEquals($response, $newResponse);
$this->assertEquals('Lorem Ipsum?', $newResponse->getContent());
}
}
|