forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlainDisplayerTest.php
More file actions
20 lines (15 loc) · 860 Bytes
/
PlainDisplayerTest.php
File metadata and controls
20 lines (15 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
use Illuminate\Exception\PlainDisplayer;
use Symfony\Component\HttpKernel\Exception\HttpException;
class PlainDisplayerTest extends PHPUnit_Framework_TestCase {
public function testStatusAndHeadersAreSetInResponse()
{
$displayer = new PlainDisplayer;
$headers = array('X-My-Test-Header' => 'HeaderValue');
$exception = new HttpException(401, 'Unauthorized', null, $headers);
$response = $displayer->display($exception);
$this->assertTrue($response->headers->has('X-My-Test-Header'), "response headers should include headers provided to the exception");
$this->assertEquals('HeaderValue', $response->headers->get('X-My-Test-Header'), "response header values should match those provided to the exception");
$this->assertEquals(401, $response->getStatusCode(), "response status should match the status provided to the exception");
}
}