Skip to content

Commit 6d21a59

Browse files
committed
minor symfony#54909 [HttpFoundation] add test for JSON response with null as content (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [HttpFoundation] add test for JSON response with null as content | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | symfony#11679 (comment) | License | MIT Commits ------- 5c37277 add test for JSON response with null as content
2 parents 84f0b88 + 5c37277 commit 6d21a59

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,14 @@ public function testConstructorWithObjectWithoutToStringMethodThrowsAnException(
294294

295295
new JsonResponse(new \stdClass(), 200, [], true);
296296
}
297+
298+
public function testSetDataWithNull()
299+
{
300+
$response = new JsonResponse();
301+
$response->setData(null);
302+
303+
$this->assertSame('null', $response->getContent());
304+
}
297305
}
298306

299307
class JsonSerializableObject implements \JsonSerializable

0 commit comments

Comments
 (0)