8000 [Form] Fix DateType for 32bits computers. by WedgeSama · Pull Request #9314 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Form] Fix DateType for 32bits computers. #9314

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 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test case to DateTypeTest
Test case to check years on 32bits machine.
  • Loading branch information
WedgeSama committed Nov 14, 2013
commit e24c970313255dd223af83fea9f09c45e61a806d
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private function listYears(array $years)
$result = array();

foreach ($years as $year) {
if(false !== $y = gmmktime(0, 0, 0, 6, 15, $year)) {
if (false !== $y = gmmktime(0, 0, 0, 6, 15, $year)) {
$result[$year] = $y;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,25 @@ public function testDayErrorsBubbleUp($widget)
$this->assertSame(array(), $form['day']->getErrors());
$this->assertSame(array($error), $form->getErrors());
}

public function testYearsFor32BitsMachines()
{
if (4 !== PHP_INT_SIZE) {
$testCase->markTestSkipped(
'PHP must be compiled in 32 bit mode to run this test');
}

$form = $this->factory->create('date', null, array(
'years' => range(1900, 2040),
));

$view = $form->createView();

$listChoices = array();
foreach(range(1902, 2037) as $y) {
$listChoices[] = new ChoiceView($y, $y, $y);
}

$this->assertEquals($listChoices, $view['year']->vars['choices']);
}
}
0