public function JsonResponseTest::testConstructorWithSimpleTypes

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php, line 41

Class

JsonResponseTest
@covers Symfony\Component\HttpFoundation\JsonResponse::__construct @covers Symfony\Component\HttpFoundation\JsonResponse::setData @covers Symfony\Component\HttpFoundation\JsonResponse::setCallback

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testConstructorWithSimpleTypes() {
  $response = new JsonResponse('foo');
  $this
    ->assertSame('"foo"', $response
    ->getContent());
  $response = new JsonResponse(0);
  $this
    ->assertSame('0', $response
    ->getContent());
  $response = new JsonResponse(0.1);
  $this
    ->assertSame('0.1', $response
    ->getContent());
  $response = new JsonResponse(true);
  $this
    ->assertSame('true', $response
    ->getContent());
}