You are here

public function JsonResponseTest::testSetCallback in Zircon Profile 8

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

File

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

Class

JsonResponseTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

public function testSetCallback() {
  $response = JsonResponse::create(array(
    'foo' => 'bar',
  ))
    ->setCallback('callback');
  $this
    ->assertEquals('/**/callback({"foo":"bar"});', $response
    ->getContent());
  $this
    ->assertEquals('text/javascript', $response->headers
    ->get('Content-Type'));
}