public function JsonResponseTest::testCreate

File

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

Class

JsonResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testCreate() {
  $response = JsonResponse::create(array(
    'foo' => 'bar',
  ), 204);
  $this
    ->assertInstanceOf('Symfony\\Component\\HttpFoundation\\JsonResponse', $response);
  $this
    ->assertEquals('{"foo":"bar"}', $response
    ->getContent());
  $this
    ->assertEquals(204, $response
    ->getStatusCode());
}