Skip to content

Commit

Permalink
Fix WeekType tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Nov 5, 2019
1 parent a307733 commit 906b82e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2771,11 +2771,11 @@ public function testWeekChoices()
{
$this->requiresFeatureSet(404);

$data = ['year' => date('Y'), 'week' => 1];
$data = ['year' => (int) date('Y'), 'week' => 1];

$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\WeekType', $data, [
'input' => 'array',
'required' => false,
'widget' => 'choice',
]);

$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
Expand Down
12 changes: 10 additions & 2 deletions src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2768,6 +2768,8 @@ public function submitFormNoValidateProvider()

public function testWeekSingleText()
{
$this->requiresFeatureSet(404);

$form = $this->factory->createNamed('holidays', 'Symfony\Component\Form\Extension\Core\Type\WeekType', '1970-W01', [
'input' => 'string',
'widget' => 'single_text',
Expand All @@ -2785,6 +2787,8 @@ public function testWeekSingleText()

public function testWeekSingleTextNoHtml5()
{
$this->requiresFeatureSet(404);

$form = $this->factory->createNamed('holidays', 'Symfony\Component\Form\Extension\Core\Type\WeekType', '1970-W01', [
'input' => 'string',
'widget' => 'single_text',
Expand All @@ -2803,11 +2807,13 @@ public function testWeekSingleTextNoHtml5()

public function testWeekChoices()
{
$data = ['year' => date('Y'), 'week' => 1];
$this->requiresFeatureSet(404);

$data = ['year' => (int) date('Y'), 'week' => 1];

$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\WeekType', $data, [
'input' => 'array',
'required' => false,
'widget' => 'choice',
]);

$this->assertWidgetMatchesXpath($form->createView(), ['attr' => ['class' => 'my&class']],
Expand All @@ -2827,6 +2833,8 @@ public function testWeekChoices()

public function testWeekText()
{
$this->requiresFeatureSet(404);

$form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\WeekType', '2000-W01', [
'input' => 'string',
'widget' => 'text',
Expand Down

0 comments on commit 906b82e

Please sign in to comment.