Révision 1f683914
Ajouté par Assos Assos il y a environ 7 ans
drupal7/sites/all/modules/date/tests/date_timezone.test | ||
---|---|---|
16 | 16 |
); |
17 | 17 |
} |
18 | 18 |
|
19 |
public function setUp() { |
|
20 |
parent::setUp(); |
|
21 |
// Set the timezone explicitly. Otherwise the site's default timezone is |
|
22 |
// used, which defaults to the server timezone when installing Drupal. This |
|
23 |
// depends on the environment and is therefore uncertain. |
|
24 |
// The Australia/Sydney timezone is chosen so all tests are run using an |
|
25 |
// edge case scenario (UTC+10 and DST). |
|
26 |
variable_set('date_default_timezone', 'Australia/Sydney'); |
|
27 |
} |
|
28 |
|
|
19 | 29 |
/** |
20 | 30 |
* @todo. |
21 | 31 |
*/ |
... | ... | |
23 | 33 |
// Create a date fields with combinations of various timezone handling and |
24 | 34 |
// granularity. |
25 | 35 |
foreach (array('date', 'datestamp', 'datetime') as $field_type) { |
26 |
foreach (array('site', 'none', 'date', 'user', 'utc') as $tz_handling) { |
|
36 |
foreach (array('site', 'none', 'date', 'user', 'utc', 'Europe/Dublin') as $tz_handling) {
|
|
27 | 37 |
foreach (array('year', 'month', 'day', 'hour', 'minute', 'second') as $max_granularity) { |
28 | 38 |
// Skip invalid combinations. |
29 | 39 |
if (in_array($max_granularity, array('year', 'month', 'day')) && $tz_handling != 'none') { |
... | ... | |
182 | 192 |
case 'hour': |
183 | 193 |
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10'; |
184 | 194 |
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11'; |
185 |
$should_be = 'Thu, 10/07/2010 - 10 to Thu, 10/07/2010 - 11'; |
|
195 |
if ($tz_handling == 'utc') { |
|
196 |
$should_be = 'Thu, 10/07/2010 - 21 to Thu, 10/07/2010 - 22'; |
|
197 |
} |
|
198 |
else { |
|
199 |
$should_be = 'Thu, 10/07/2010 - 10 to Thu, 10/07/2010 - 11'; |
|
200 |
} |
|
186 | 201 |
break; |
187 | 202 |
case 'minute': |
188 | 203 |
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10:30'; |
189 | 204 |
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11:30'; |
190 |
$should_be = 'Thu, 10/07/2010 - 10:30 to 11:30'; |
|
205 |
if ($tz_handling == 'utc') { |
|
206 |
$should_be = 'Thu, 10/07/2010 - 21:30 to 22:30'; |
|
207 |
} |
|
208 |
else { |
|
209 |
$should_be = 'Thu, 10/07/2010 - 10:30 to 11:30'; |
|
210 |
} |
|
191 | 211 |
break; |
192 | 212 |
case 'second': |
193 | 213 |
$edit[$field_name . '[und][0][value][date]'] = '10/07/2010 - 10:30:30'; |
194 | 214 |
$edit[$field_name . '[und][0][value2][date]'] = '10/07/2010 - 11:30:30'; |
195 |
$should_be = 'Thu, 10/07/2010 - 10:30:30 to 11:30:30'; |
|
215 |
if ($tz_handling == 'utc') { |
|
216 |
$should_be = 'Thu, 10/07/2010 - 21:30:30 to 22:30:30'; |
|
217 |
} |
|
218 |
else { |
|
219 |
$should_be = 'Thu, 10/07/2010 - 10:30:30 to 11:30:30'; |
|
220 |
} |
|
196 | 221 |
break; |
197 | 222 |
} |
198 | 223 |
$this->drupalPost('node/add/story', $edit, t('Save')); |
Formats disponibles : Unified diff
Weekly update of contrib modules