updated packages

This commit is contained in:
2019-05-18 09:06:43 +00:00
parent 901d16349e
commit e9487fa58a
2025 changed files with 30366 additions and 49653 deletions

View File

@@ -24,13 +24,13 @@ class JsonResponseTest extends TestCase
public function testConstructorWithArrayCreatesJsonArray()
{
$response = new JsonResponse(array(0, 1, 2, 3));
$response = new JsonResponse([0, 1, 2, 3]);
$this->assertSame('[0,1,2,3]', $response->getContent());
}
public function testConstructorWithAssocArrayCreatesJsonObject()
{
$response = new JsonResponse(array('foo' => 'bar'));
$response = new JsonResponse(['foo' => 'bar']);
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
@@ -51,7 +51,7 @@ class JsonResponseTest extends TestCase
public function testConstructorWithCustomStatus()
{
$response = new JsonResponse(array(), 202);
$response = new JsonResponse([], 202);
$this->assertSame(202, $response->getStatusCode());
}
@@ -63,35 +63,35 @@ class JsonResponseTest extends TestCase
public function testConstructorWithCustomHeaders()
{
$response = new JsonResponse(array(), 200, array('ETag' => 'foo'));
$response = new JsonResponse([], 200, ['ETag' => 'foo']);
$this->assertSame('application/json', $response->headers->get('Content-Type'));
$this->assertSame('foo', $response->headers->get('ETag'));
}
public function testConstructorWithCustomContentType()
{
$headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
$headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json'];
$response = new JsonResponse(array(), 200, $headers);
$response = new JsonResponse([], 200, $headers);
$this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
}
public function testSetJson()
{
$response = new JsonResponse('1', 200, array(), true);
$response = new JsonResponse('1', 200, [], true);
$this->assertEquals('1', $response->getContent());
$response = new JsonResponse('[1]', 200, array(), true);
$response = new JsonResponse('[1]', 200, [], true);
$this->assertEquals('[1]', $response->getContent());
$response = new JsonResponse(null, 200, array());
$response = new JsonResponse(null, 200, []);
$response->setJson('true');
$this->assertEquals('true', $response->getContent());
}
public function testCreate()
{
$response = JsonResponse::create(array('foo' => 'bar'), 204);
$response = JsonResponse::create(['foo' => 'bar'], 204);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertEquals('{"foo":"bar"}', $response->getContent());
@@ -107,14 +107,14 @@ class JsonResponseTest extends TestCase
public function testStaticCreateJsonArray()
{
$response = JsonResponse::create(array(0, 1, 2, 3));
$response = JsonResponse::create([0, 1, 2, 3]);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertSame('[0,1,2,3]', $response->getContent());
}
public function testStaticCreateJsonObject()
{
$response = JsonResponse::create(array('foo' => 'bar'));
$response = JsonResponse::create(['foo' => 'bar']);
$this->assertInstanceOf('Symfony\Component\HttpFoundation\JsonResponse', $response);
$this->assertSame('{"foo":"bar"}', $response->getContent());
}
@@ -140,7 +140,7 @@ class JsonResponseTest extends TestCase
public function testStaticCreateWithCustomStatus()
{
$response = JsonResponse::create(array(), 202);
$response = JsonResponse::create([], 202);
$this->assertSame(202, $response->getStatusCode());
}
@@ -152,22 +152,22 @@ class JsonResponseTest extends TestCase
public function testStaticCreateWithCustomHeaders()
{
$response = JsonResponse::create(array(), 200, array('ETag' => 'foo'));
$response = JsonResponse::create([], 200, ['ETag' => 'foo']);
$this->assertSame('application/json', $response->headers->get('Content-Type'));
$this->assertSame('foo', $response->headers->get('ETag'));
}
public function testStaticCreateWithCustomContentType()
{
$headers = array('Content-Type' => 'application/vnd.acme.blog-v1+json');
$headers = ['Content-Type' => 'application/vnd.acme.blog-v1+json'];
$response = JsonResponse::create(array(), 200, $headers);
$response = JsonResponse::create([], 200, $headers);
$this->assertSame('application/vnd.acme.blog-v1+json', $response->headers->get('Content-Type'));
}
public function testSetCallback()
{
$response = JsonResponse::create(array('foo' => 'bar'))->setCallback('callback');
$response = JsonResponse::create(['foo' => 'bar'])->setCallback('callback');
$this->assertEquals('/**/callback({"foo":"bar"});', $response->getContent());
$this->assertEquals('text/javascript', $response->headers->get('Content-Type'));
@@ -190,7 +190,7 @@ class JsonResponseTest extends TestCase
public function testSetEncodingOptions()
{
$response = new JsonResponse();
$response->setData(array(array(1, 2, 3)));
$response->setData([[1, 2, 3]]);
$this->assertEquals('[[1,2,3]]', $response->getContent());
@@ -239,7 +239,7 @@ class JsonResponseTest extends TestCase
public function testSetComplexCallback()
{
$response = JsonResponse::create(array('foo' => 'bar'));
$response = JsonResponse::create(['foo' => 'bar']);
$response->setCallback('ಠ_ಠ["foo"].bar[0]');
$this->assertEquals('/**/ಠ_ಠ["foo"].bar[0]({"foo":"bar"});', $response->getContent());