forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpJsonResponseTest.php
More file actions
32 lines (24 loc) · 885 Bytes
/
HttpJsonResponseTest.php
File metadata and controls
32 lines (24 loc) · 885 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
<?php
class HttpJsonResponseTest extends PHPUnit_Framework_TestCase {
public function testSetAndRetrieveData()
{
$response = new Illuminate\Http\JsonResponse(array('foo' => 'bar'));
$data = $response->getData();
$this->assertInstanceOf('StdClass', $data);
$this->assertEquals('bar', $data->foo);
}
public function testSetAndRetrieveOptions()
{
$response = new Illuminate\Http\JsonResponse(['foo' => 'bar']);
$response->setJsonOptions(JSON_PRETTY_PRINT);
$this->assertSame(JSON_PRETTY_PRINT, $response->getJsonOptions());
}
public function testSetAndRetrieveStatusCode()
{
$response = new Illuminate\Http\JsonResponse(['foo' => 'bar'], 404);
$this->assertSame(404, $response->getStatusCode());
$response = new Illuminate\Http\JsonResponse(['foo' => 'bar']);
$response->setStatusCode(404);
$this->assertSame(404, $response->getStatusCode());
}
}