8000 [DoctrineBridge] Guess correct form types for DATE_IMMUTABLE and DATETIME_IMMUTABLE by guillaume-sainthillier · Pull Request #39498 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[DoctrineBridge] Guess correct form types for DATE_IMMUTABLE and DATETIME_IMMUTABLE #39498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
8000 Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added one more test
  • Loading branch information
guillaume-sainthillier committed Dec 14, 2020
commit 2b8b5a4219804fb0dfe3f5ed32e987eb66336c7b
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ public function requiredType()
{
$return = [];

// DateTime field
// DateImmutable field
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata->fieldMappings['field'] = true;
$classMetadata->expects($this->once())->method('getTypeOfField')->with('field')->willReturn(Types::DATE_IMMUTABLE);

$return[] = [$classMetadata, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];


// DateTimeImmutable field
$classMetadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
$classMetadata->fieldMappings['field'] = true;
$classMetadata->expects($this->once())->method('getTypeOfField')->with('field')->willReturn(Types::DATETIME_IMMUTABLE);

$return[] = [$classMetadata, new TypeGuess('Symfony\Component\Form\Extension\Core\Type\DateTimeType', ['input' => 'datetime_immutable'], Guess::HIGH_CONFIDENCE)];

return $return;
}

Expand Down
0