public function testJsonWithSerializerContextOverride()
{
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
$container->expects($this->once())->method('has')->with('serializer')->will($this->returnValue(true));
$serializer = $this->getMockBuilder(SerializerInterface::class)->getMock();
$serializer->expects($this->once())->method('serialize')->with(array(), 'json', array('json_encode_options' => 0, 'other' => 'context'))->will($this->returnValue('[]'));
$container->expects($this->once())->method('get')->with('serializer')->will($this->returnValue($serializer));
$controller = new TestController();
$controller->setContainer($container);
$response = $controller->json(array(), 200, array(), array('json_encode_options' => 0, 'other' => 'context'));
$this->assertInstanceOf(JsonResponse::class, $response);
$this->assertEquals('[]', $response->getContent());
$response->setEncodingOptions(JSON_FORCE_OBJECT);
$this->assertEquals('{}', $response->getContent());
}