8000 Add missing required options to JSON output · symfony/symfony@d67dc00 · GitHub
[go: up one dir, main page]

Skip to content

Commit d67dc00

Browse files
committed
Add missing required options to JSON output
1 parent 7203a45 commit d67dc00

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/Symfony/Component/Form/Console/Descriptor/JsonDescriptor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ protected function describeResolvedFormType(ResolvedFormTypeInterface $resolvedF
2929
'overridden' => $this->overriddenOptions,
3030
'parent' => $this->parentOptions,
3131
'extension' => $this->extensionOptions,
32+
'required' => $this->requiredOptions,
3233
);
3334
$this->sortOptions($formOptions);
3435

src/Symfony/Component/Form/Tests/Console/Descriptor/AbstractDescriptorTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ public function testDescribeResolvedFormType(ResolvedFormTypeInterface $type, ar
3030
$expectedDescription = $this->getExpectedDescription($fixtureName);
3131
$describedObject = $this->getObjectDescription($type, $options);
3232

33-
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $describedObject)));
33+
if ('json' === $this->getFormat()) {
34+
$this->assertEquals(json_encode(json_decode($expectedDescription), JSON_PRETTY_PRINT), json_encode(json_decode($describedObject), JSON_PRETTY_PRINT));
35+
} else {
36+
$this->assertEquals(trim($expectedDescription), trim(str_replace(PHP_EOL, "\n", $describedObject)));
37+
}
3438
}
3539

3640
public function getDescribeResolvedFormTypeTestData()

src/Symfony/Component/Form/Tests/Fixtures/Descriptor/resolved_form_type_1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@
5656
"csrf_token_id",
5757
"csrf_token_manager"
5858
]
59-
}
59+
},
60+
"required": []
6061
},
6162
"parent_types": [
6263
"Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType"

0 commit comments

Comments
 (0)
0