Skip to content

Commit 1ea742a

Browse files
committed
Merge branch '2.7'
* 2.7: (24 commits) bumped Symfony version to 2.6.4 updated VERSION for 2.6.3 updated CHANGELOG for 2.6.3 bumped Symfony version to 2.6.3 updated VERSION for 2.6.2 updated CHANGELOG for 2.6.2 bumped Symfony version to 2.5.10 updated VERSION for 2.5.9 updated CHANGELOG for 2.5.9 [FrameworkBundle] Use security.token_storage service in Controller::getUser() bumped Symfony version to 2.3.25 updated VERSION for 2.3.24 update CONTRIBUTORS for 2.3.24 added missing E_USER_DEPRECATED argument to trigger_error() calls Removed unneeded version requirements updated CHANGELOG for 2.3.24 fixed tests [Security] Don't destroy the session on buggy php releases. Enhance deprecation summary at end of tests [2.7] silence deprecations for getFactory*() BC layer ... Conflicts: CHANGELOG-2.3.md CHANGELOG-2.5.md CHANGELOG-2.6.md src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
2 parents 3f0450e + 190c94a commit 1ea742a

File tree

5 files changed

+121
-31
lines changed

5 files changed

+121
-31
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
CHANGELOG
22
=========
33

4+
2.6.2
5+
-----
6+
7+
* Added back the `model_timezone` and `view_timezone` options for `TimeType`, `DateType`
8+
and `BirthdayType`
9+
410
2.6.0
511
-----
612

713
* added "html5" option to Date, Time and DateTimeFormType to be able to
814
enable/disable HTML5 input date when widget option is "single_text"
915
* added "label_format" option with possible placeholders "%name%" and "%id%"
10-
* [BC BREAK] drop support for model_timezone and view_timezone options in TimeType, DateType and BirthdayType
16+
* [BC BREAK] drop support for model_timezone and view_timezone options in TimeType, DateType and BirthdayType,
17+
update to 2.6.2 to get back support for these options
1118

1219
2.5.0
1320
------

Extension/Core/Type/TimeType.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ public function setDefaultOptions(OptionsResolverInterface $resolver)
197197
'input' => 'datetime',
198198
'with_minutes' => true,
199199
'with_seconds' => false,
200+
'model_timezone' => null,
201+
'view_timezone' => null,
200202
'empty_value' => $emptyValue, // deprecated
201203
'placeholder' => $placeholder,
202204
'html5' => true,

Tests/Extension/Core/Type/DateTypeTest.php

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ public function testInvalidInputOption()
6060
public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
6161
{
6262
$form = $this->factory->create('date', null, array(
63+
'model_timezone' => 'UTC',
64+
'view_timezone' => 'UTC',
6365
'widget' => 'single_text',
6466
'input' => 'datetime',
6567
));
@@ -74,6 +76,8 @@ public function testSubmitFromSingleTextDateTime()
7476
{
7577
$form = $this->factory->create('date', null, array(
7678
'format' => \IntlDateFormatter::MEDIUM,
79+
'model_timezone' => 'UTC',
80+
'view_timezone' => 'UTC',
7781
'widget' => 'single_text',
7882
'input' => 'datetime',
7983
));
@@ -88,6 +92,8 @@ public function testSubmitFromSingleTextString()
8892
{
8993
$form = $this->factory->create('date', null, array(
9094
'format' => \IntlDateFormatter::MEDIUM,
95+
'model_timezone' => 'UTC',
96+
'view_timezone' => 'UTC',
9197
'widget' => 'single_text',
9298
'input' => 'string',
9399
));
@@ -102,6 +108,8 @@ public function testSubmitFromSingleTextTimestamp()
102108
{
103109
$form = $this->factory->create('date', null, array(
104110
'format' => \IntlDateFormatter::MEDIUM,
111+
'model_timezone' => 'UTC',
112+
'view_timezone' => 'UTC',
105113
'widget' => 'single_text',
106114
'input' => 'timestamp',
107115
));
@@ -118,6 +126,8 @@ public function testSubmitFromSingleTextRaw()
118126
{
119127
$form = $this->factory->create('date', null, array(
120128
'format' => \IntlDateFormatter::MEDIUM,
129+
'model_timezone' => 'UTC',
130+
'view_timezone' => 'UTC',
121131
'widget' => 'single_text',
122132
'input' => 'array',
123133
));
@@ -137,6 +147,8 @@ public function testSubmitFromSingleTextRaw()
137147
public function testSubmitFromText()
138148
{
139149
$form = $this->factory->create('date', null, array(
150+
'model_timezone' => 'UTC',
151+
'view_timezone' => 'UTC',
140152
'widget' => 'text',
141153
));
142154

@@ -157,6 +169,8 @@ public function testSubmitFromText()
157169
public function testSubmitFromChoice()
158170
{
159171
$form = $this->factory->create('date', null, array(
172+
'model_timezone' => 'UTC',
173+
'view_timezone' => 'UTC',
160174
'widget' => 'choice',
161175
));
162176

@@ -177,6 +191,8 @@ public function testSubmitFromChoice()
177191
public function testSubmitFromChoiceEmpty()
178192
{
179193
$form = $this->factory->create('date', null, array(
194+
'model_timezone' => 'UTC',
195+
'view_timezone' => 'UTC',
180196
'widget' => 'choice',
181197
'required' => false,
182198
));
@@ -196,6 +212,8 @@ public function testSubmitFromChoiceEmpty()
196212
public function testSubmitFromInputDateTimeDifferentPattern()
197213
{
198214
$form = $this->factory->create('date', null, array(
215+
'model_timezone' => 'UTC',
216+
'view_timezone' => 'UTC',
199217
'format' => 'MM*yyyy*dd',
200218
'widget' => 'single_text',
201219
'input' => 'datetime',
@@ -210,6 +228,8 @@ public function testSubmitFromInputDateTimeDifferentPattern()
210228
public function testSubmitFromInputStringDifferentPattern()
211229
{
212230
$form = $this->factory->create('date', null, array(
231+
'model_timezone' => 'UTC',
232+
'view_timezone' => 'UTC',
213233
'format' => 'MM*yyyy*dd',
214234
'widget' => 'single_text',
215235
'input' => 'string',
@@ -224,6 +244,8 @@ public function testSubmitFromInputStringDifferentPattern()
224244
public function testSubmitFromInputTimestampDifferentPattern()
225245
{
226246
$form = $this->factory->create('date', null, array(
247+
'model_timezone' => 'UTC',
248+
'view_timezone' => 'UTC',
227249
'format' => 'MM*yyyy*dd',
228250
'widget' => 'single_text',
229251
'input' => 'timestamp',
@@ -240,6 +262,8 @@ public function testSubmitFromInputTimestampDifferentPattern()
240262
public function testSubmitFromInputRawDifferentPattern()
241263
{
242264
$form = $this->factory->create('date', null, array(
265+
'model_timezone' => 'UTC',
266+
'view_timezone' => 'UTC',
243267
'format' => 'MM*yyyy*dd',
244268
'widget' => 'single_text',
245269
'input' => 'array',
@@ -358,10 +382,25 @@ public function testThrowExceptionIfDaysIsInvalid()
358382

359383
public function testSetDataWithDifferentNegativeUTCTimezoneDateTime()
360384
{
361-
date_default_timezone_set('Pacific/Tahiti');
385+
$form = $this->factory->create('date', null, array(
386+
'format' => \IntlDateFormatter::MEDIUM,
387+
'model_timezone' => 'America/New_York',
388+
'view_timezone' => 'Pacific/Tahiti',
389+
'input' => 'string',
390+
'widget' => 'single_text',
391+
));
362392

393+
$form->setData('2010-06-02');
394+
395+
$this->assertEquals('01.06.2010', $form->getViewData());
396+
}
397+
398+
public function testSetDataWithDifferentTimezonesDateTime()
399+
{
363400
$form = $this->factory->create('date', null, array(
364401
'format' => \IntlDateFormatter::MEDIUM,
402+
'model_timezone' => 'America/New_York',
403+
'view_timezone' => 'Pacific/Tahiti',
365404
'input' => 'datetime',
366405
'widget' => 'single_text',
367406
));
@@ -371,7 +410,7 @@ public function testSetDataWithDifferentNegativeUTCTimezoneDateTime()
371410
$form->setData($dateTime);
372411

373412
$this->assertDateTimeEquals($dateTime, $form->getData());
374-
$this->assertEquals('02.06.2010', $form->getViewData());
413+
$this->assertEquals('01.06.2010', $form->getViewData());
375414
}
376415

377416
public function testSetDataWithDifferentPositiveUTCTimezoneDateTime()
@@ -520,6 +559,8 @@ public function testIsPartiallyFilledReturnsFalseIfSingleText()
520559
$this->markTestIncomplete('Needs to be reimplemented using validators');
521560

522561
$form = $this->factory->create('date', null, array(
562+
'model_timezone' => 'UTC',
563+
'view_timezone' => 'UTC',
523564
'widget' => 'single_text',
524565
));
525566

@@ -533,6 +574,8 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyEmpty()
533574
$this->markTestIncomplete('Needs to be reimplemented using validators');
534575

535576
$form = $this->factory->create('date', null, array(
577+
'model_timezone' => 'UTC',
578+
'view_timezone' => 'UTC',
536579
'widget' => 'choice',
537580
));
538581

@@ -550,6 +593,8 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyFilled()
550593
$this->markTestIncomplete('Needs to be reimplemented using validators');
551594

552595
$form = $this->factory->create('date', null, array(
596+
'model_timezone' => 'UTC',
597+
'view_timezone' => 'UTC',
553598
'widget' => 'choice',
554599
));
555600

@@ -567,6 +612,8 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
567612
$this->markTestIncomplete('Needs to be reimplemented using validators');
568613

569614
$form = $this->factory->create('date', null, array(
615+
'model_timezone' => 'UTC',
616+
'view_timezone' => 'UTC',
570617
'widget' => 'choice',
571618
));
572619

0 commit comments

Comments
 (0)