8000 do not depend on a fixed date in layout tests · symfony/symfony@97b7fab · GitHub
[go: up one dir, main page]

Skip to content

Commit 97b7fab

Browse files
committed
do not depend on a fixed date in layout tests
By default, the `DateType` as well as the `DateTimeType` set the choices being available for the year to a range starting five years in the past. After some time, this will make tests fail when the year of the fixed date being used as the initial data is before the first year being part of the choices.
1 parent 6699928 commit 97b7fab

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

src/Symfony/Bridge/Twig/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"symfony/asset": "~2.7",
2424
"symfony/finder": "~2.3",
25-
"symfony/form": "~2.7.11|~2.8.4",
25+
"symfony/form": "~2.7.23|~2.8.16",
2626
"symfony/http-kernel": "~2.3",
2727
"symfony/intl": "~2.3",
2828
"symfony/routing": "~2.2",

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"symfony/dom-crawler": "~2.0,>=2.0.5",
4141
"symfony/intl": "~2.3",
4242
"symfony/security": "~2.6",
43-
"symfony/form": "~2.7,>=2.7.2",
43+
"symfony/form": "~2.7.23|~2.8.16",
4444
"symfony/class-loader": "~2.1",
4545
"symfony/expression-language": "~2.6",
4646
"symfony/process": "~2.0,>=2.0.5",

src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ public function testCountryWithPlaceholder()
13331333

13341334
public function testDateTime()
13351335
{
1336-
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
1336+
$form = $this->factory->createNamed('name', 'datetime', date('Y').'-02-03 04:05:06', array(
13371337
'input' => 'string',
13381338
'with_seconds' => false,
13391339
));
@@ -1352,7 +1352,7 @@ public function testDateTime()
13521352
/following-sibling::select
13531353
[@id="name_date_year"]
13541354
[@class="form-control"]
1355-
[./option[@value="2011"][@selected="selected"]]
1355+
[./option[@value="'.date('Y').'"][@selected="selected"]]
13561356
/following-sibling::select
13571357
[@id="name_time_hour"]
13581358
[@class="form-control"]
@@ -1407,7 +1407,7 @@ public function testDateTimeWithPlaceholderGlobal()
14071407

14081408
public function testDateTimeWithHourAndMinute()
14091409
{
1410-
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
1410+
$data = array('year' => date('Y'), 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
14111411

14121412
$form = $this->factory->createNamed('name', 'datetime', $data, array(
14131413
'input' => 'array',
@@ -1429,7 +1429,7 @@ public function testDateTimeWithHourAndMinute()
14291429
/following-sibling::select
14301430
[@id="name_date_year"]
14311431
[@class="form-control"]
1432-
[./option[@value="2011"][@selected="selected"]]
1432+
[./option[@value="'.date('Y').'"][@selected="selected"]]
14331433
/following-sibling::select
14341434
[@id="name_time_hour"]
14351435
[@class="form-control"]
@@ -1446,7 +1446,7 @@ public function testDateTimeWithHourAndMinute()
14461446

14471447
public function testDateTimeWithSeconds()
14481448
{
1449-
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
1449+
$form = $this->factory->createNamed('name', 'datetime', date('Y').'-02-03 04:05:06', array(
14501450
'input' => 'string',
14511451
'with_seconds' => true,
14521452
));
@@ -1466,7 +1466,7 @@ public function testDateTimeWithSeconds()
14661466
/following-sibling::select
14671467
[@id="name_date_year"]
14681468
[@class="form-control"]
1469-
[./option[@value="2011"][@selected="selected"]]
1469+
[./option[@value="'.date('Y').'"][@selected="selected"]]
14701470
/following-sibling::select
14711471
[@id="name_time_hour"]
14721472
[@class="form-control"]
@@ -1556,7 +1556,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
15561556

15571557
public function testDateChoice()
15581558
{
1559-
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
1559+
$form = $this->factory->createNamed('name', 'date', date('Y').'-02-03', array(
15601560
'input' => 'string',
15611561
'widget' => 'choice',
15621562
));
@@ -1576,7 +1576,7 @@ public function testDateChoice()
15761576
/following-sibling::select
15771577
[@id="name_year"]
15781578
[@class="form-control"]
1579-
[./option[@value="2011"][@selected="selected"]]
1579+
[./option[@value="'.date('Y').'"][@selected="selected"]]
15801580
]
15811581
[count(./select)=3]
15821582
'

src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ public function testCountryWithPlaceholder()
12261226

12271227
public function testDateTime()
12281228
{
1229-
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
1229+
$form = $this->factory->createNamed('name', 'datetime', date('Y').'-02-03 04:05:06', array(
12301230
'input' => 'string',
12311231
'with_seconds' => false,
12321232
));
@@ -1245,7 +1245,7 @@ public function testDateTime()
12451245
[./option[@value="3"][@selected="selected"]]
12461246
/following-sibling::select
12471247
[@id="name_date_year"]
1248-
[./option[@value="2011"][@selected="selected"]]
1248+
[./option[@value="'.date('Y').'"][@selected="selected"]]
12491249
]
12501250
/following-sibling::div
12511251
[@id="name_time"]
@@ -1305,7 +1305,7 @@ public function testDateTimeWithPlaceholderGlobal()
13051305

13061306
public function testDateTimeWithHourAndMinute()
13071307
{
1308-
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
1308+
$data = array('year' => date('Y'), 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
13091309

13101310
$form = $this->factory->createNamed('name', 'datetime', $data, array(
13111311
'input' => 'array',
@@ -1326,7 +1326,7 @@ public function testDateTimeWithHourAndMinute()
13261326
[./option[@value="3"][@selected="selected"]]
13271327
/following-sibling::select
13281328
[@id="name_date_year"]
1329-
[./option[@value="2011"][@selected="selected"]]
1329+
[./option[@value="'.date('Y').'"][@selected="selected"]]
13301330
]
13311331
/following-sibling::div
13321332
[@id="name_time"]
@@ -1346,7 +1346,7 @@ public function testDateTimeWithHourAndMinute()
13461346

13471347
public function testDateTimeWithSeconds()
13481348
{
1349-
$form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
1349+
$form = $this->factory->createNamed('name', 'datetime', date('Y').'-02-03 04:05:06', array(
13501350
'input' => 'string',
13511351
'with_seconds' => true,
13521352
));
@@ -1365,7 +1365,7 @@ public function testDateTimeWithSeconds()
13651365
[./option[@value="3"][@selected="selected"]]
13661366
/following-sibling::select
13671367
[@id="name_date_year"]
1368-
[./option[@value="2011"][@selected="selected"]]
1368+
[./option[@value="'.date('Y').'"][@selected="selected"]]
13691369
]
13701370
/following-sibling::div
13711371
[@id="name_time"]
@@ -1452,7 +1452,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
14521452

14531453
public function testDateChoice()
14541454
{
1455-
$form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
1455+
$form = $this->factory->createNamed('name', 'date', date('Y').'-02-03', array(
14561456
'input' => 'string',
14571457
'widget' => 'choice',
14581458
));
@@ -1468,7 +1468,7 @@ public function testDateChoice()
14681468
[./option[@value="3"][@selected="selected"]]
14691469
/following-sibling::select
14701470
[@id="name_year"]
1471-
[./option[@value="2011"][@selected="selected"]]
1471+
[./option[@value="'.date('Y').'"][@selected="selected"]]
14721472
]
14731473
[count(./select)=3]
14741474
'

0 commit comments

Comments
 (0)
0