8000 Fix debug:form dateTime · symfony/symfony@22b20ca · GitHub
[go: up one dir, main page]

Skip to content

Commit 22b20ca

Browse files
committed
Fix debug:form dateTime
1 parent 4619ae4 commit 22b20ca

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Symfony/Component/Form/Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
115115
sort($options[$k]);
116116
}
117117
} else {
118-
if (!class_exists($class)) {
118+
if (!class_exists($class) || !is_subclass_of($class, FormTypeInterface::class)) {
119119
$class = $this->getFqcnTypeClass($input, $io, $class);
120120
}
121121
$resolvedType = $this->formRegistry->getType($class);

src/Symfony/Component/Form/Tests/Command/DebugCommandTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ public function testDebugSingleFormType()
6666
$this->assertContains('Symfony\Component\Form\Extension\Core\Type\FormType (Block prefix: "form")', $tester->getDisplay());
6767
}
6868

69+
public function testDebugDateTimeType()
70+
{
71+
$tester = $this->createCommandTester();
72+
$tester->execute(['class' => 'DateTime'], ['decorated' => false, 'interactive' => false]);
73+
74+
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
75+
$this->assertContains('Symfony\Component\Form\Extension\Core\Type\DateTimeType (Block prefix: "datetime")', $tester->getDisplay());
76+
}
77+
6978
public function testDebugFormTypeOption()
7079
{
7180
$tester = $this->createCommandTester();

0 commit comments

Comments
 (0)
0