You are here

public function JsonResponseTest::testStaticCreateWithSimpleTypes in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-foundation/Tests/JsonResponseTest.php \Symfony\Component\HttpFoundation\Tests\JsonResponseTest::testStaticCreateWithSimpleTypes()

File

vendor/symfony/http-foundation/Tests/JsonResponseTest.php, line 108

Class

JsonResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testStaticCreateWithSimpleTypes() {
  $response = JsonResponse::create('foo');
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
  $this
    ->assertSame('"foo"', $response
    ->getContent());
  $response = JsonResponse::create(0);
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
  $this
    ->assertSame('0', $response
    ->getContent());
  $response = JsonResponse::create(0.1);
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
  $this
    ->assertSame('0.1', $response
    ->getContent());
  $response = JsonResponse::create(true);
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
  $this
    ->assertSame('true', $response
    ->getContent());
}