Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1939d4f

Browse filesBrowse files
author
Alexey Deriyenko
committed
linting
1 parent fb3aff6 commit 1939d4f
Copy full SHA for 1939d4f

File tree

Expand file treeCollapse file tree

1 file changed

+18
-14
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+18
-14
lines changed

‎src/Symfony/Component/Serializer/Tests/ErrorRenderer/SerializerErrorRendererTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Tests/ErrorRenderer/SerializerErrorRendererTest.php
+18-14Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,78 +10,82 @@
1010

1111
namespace Symfony\Component\Serializer\Tests\ErrorRenderer;
1212

13+
use function json_decode;
1314
use PHPUnit\Framework\TestCase;
1415
use Symfony\Component\ErrorHandler\ErrorRenderer\SerializerErrorRenderer;
15-
use Symfony\Component\Serializer\Serializer;
1616
use Symfony\Component\Serializer\Encoder\JsonEncoder;
1717
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
18-
19-
use function \json_decode;
18+
use Symfony\Component\Serializer\Serializer;
2019

2120
/**
2221
* @author Alexey Deriyenko <alexey.deriyenko@gmail.com>
2322
*/
24-
class SerializerErrorRendererTest extends TestCase {
23+
class SerializerErrorRendererTest extends TestCase
24+
{
2525
/**
2626
* @dataProvider getRenderData
2727
*/
28-
public function testRenderReturnsJson(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer) {
28+
public function testRenderReturnsJson(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer)
29+
{
2930
$this->assertJson($serializerErrorRenderer->render($exception)->getAsString());
3031
}
3132

3233
/**
3334
* @dataProvider getRenderData
3435
*/
35-
public function testRenderReturnsJsonWithCorrectStatusCode(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer, int $expectedStatusCode) {
36+
public function testRenderReturnsJsonWithCorrectStatusCode(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer, int $expectedStatusCode)
37+
{
3638
$statusCodeFromJson = json_decode($serializerErrorRenderer->render($exception)->getAsString())->statusCode;
3739
$this->assertEquals($expectedStatusCode, $statusCodeFromJson);
3840
}
3941

4042
/**
4143
* @dataProvider getRenderData
4244
*/
43-
public function testRenderReturnsJsonWithCorrectStatusText(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer, int $expectedStatusCode, string $expectedStatusText) {
45+
public function testRenderReturnsJsonWithCorrectStatusText(\Throwable $exception, SerializerErrorRenderer $serializerErrorRenderer, int $expectedStatusCode, string $expectedStatusText)
46+
{
4447
$statusTextFromJson = json_decode($serializerErrorRenderer->render($exception)->getAsString())->statusText;
4548
$this->assertEquals($expectedStatusText, $statusTextFromJson);
4649
}
4750

48-
public function getRenderData(): iterable {
51+
public function getRenderData(): iterable
52+
{
4953
yield '->render() returns the JSON content WITH stack traces in debug mode' => [
5054
new \RuntimeException('Foo'),
5155
new SerializerErrorRenderer(new Serializer([new ObjectNormalizer()], [new JsonEncoder()]), 'json', null, true),
5256
500,
53-
'Internal Server Error'
57+
'Internal Server Error',
5458
];
5559

5660
yield '->render() returns the JSON content WITHOUT stack traces in non-debug mode' => [
5761
new \RuntimeException('Foo'),
5862
new SerializerErrorRenderer(new Serializer([new ObjectNormalizer()], [new JsonEncoder()]), 'json', null, false),
5963
500,
60-
'Internal Server Error'
64+
'Internal Server Error',
6165
];
6266

6367
yield '->render() returns the JSON content WITH stack traces in debug mode and contains the correct status code' => [
6468
new \RuntimeException('Foo'),
6569
new SerializerErrorRenderer(new Serializer([new ObjectNormalizer()], [new JsonEncoder()]), 'json', null, true, [
6670
\RuntimeException::class => [
6771
'status_code' => 418,
68-
'log_level' => null,
72+
'log_level' => null,
6973
],
7074
]),
7175
418,
72-
'I\'m a teapot'
76+
'I\'m a teapot',
7377
];
7478

7579
yield '->render() returns the JSON content WITHOUT stack traces in non-debug mode and contains the correct status code' => [
7680
new \RuntimeException('Foo'),
7781
new SerializerErrorRenderer(new Serializer([new ObjectNormalizer()], [new JsonEncoder()]), 'json', null, true, [
7882
\RuntimeException::class => [
7983
'status_code' => 418,
80-
'log_level' => null,
84+
'log_level' => null,
8185
],
8286
]),
8387
418,
84-
'I\'m a teapot'
88+
'I\'m a teapot',
8589
];
8690
}
8791
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.