Laravel version update

Laravel version update
This commit is contained in:
Manish Verma
2018-08-06 18:48:58 +05:30
parent d143048413
commit 126fbb0255
13678 changed files with 1031482 additions and 778530 deletions

View File

@@ -11,10 +11,20 @@
namespace Symfony\Component\HttpFoundation\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\JsonResponse;
class JsonResponseTest extends \PHPUnit_Framework_TestCase
class JsonResponseTest extends TestCase
{
protected function setUp()
{
parent::setUp();
if (!\defined('HHVM_VERSION')) {
$this->iniSet('serialize_precision', 14);
}
}
public function testConstructorEmptyCreatesJsonObject()
{
$response = new JsonResponse();
@@ -75,6 +85,19 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase
$this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
}
public function testSetJson()
{
$response = new JsonResponse('1', 200, array(), true);
$this->assertEquals('1', $response->getContent());
$response = new JsonResponse('[1]', 200, array(), true);
$this->assertEquals('[1]', $response->getContent());
$response = new JsonResponse(null, 200, array());
$response->setJson('true');
$this->assertEquals('true', $response->getContent());
}
public function testCreate()
{
$response = JsonResponse::create(array('foo' => 'bar'), 204);
@@ -185,6 +208,12 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('{"0":{"0":1,"1":2,"2":3}}', $response->getContent());
}
public function testItAcceptsJsonAsString()
{
$response = JsonResponse::fromJsonString('{"foo":"bar"}');
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
/**
* @expectedException \InvalidArgumentException
*/
@@ -208,13 +237,25 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase
*/
public function testSetContentJsonSerializeError()
{
if (!interface_exists('JsonSerializable', false)) {
$this->markTestSkipped('JsonSerializable is required.');
}
$serializable = new JsonSerializableObject();
JsonResponse::create($serializable);
}
public function testSetComplexCallback()
{
$response = JsonResponse::create(array('foo' => 'bar'));
$response->setCallback('ಠ_ಠ["foo"].bar[0]');
$this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent());
}
}
if (interface_exists('JsonSerializable')) {
if (interface_exists('JsonSerializable', false)) {
class JsonSerializableObject implements \JsonSerializable
{
public function jsonSerialize()